SOLVED LAMP Laravel and npm
I have LAMP and Laravel. By documentation npm install should work: https://docs.cloudron.io/apps/lamp/ but for www-data user I get command not found.
If I check npm -v with root I get version, but I can't run npm install in /app/data/public.
p.s. would be great to update this guide: https://docs.cloudron.io/guides/lamp-laravel/
I think the problem is, that the www-data user has not setup the nodejs environment here. Since installing modules is likely an admin task here, I assume it would be fine to use root here and if needed change the permissions of the files later, but mostly those should not be written to or changed anyways.
As far as I can tell, running npm as root within the
/app/data/directory will result in an npm cache failure. This can be mitigated by specifying a HOME directory, so you should be able to run npm fine as root using the following:
HOME=/app/data/ npm install
Regarding the docs, I will see how to fixup https://docs.cloudron.io/apps/lamp/#running-composer-npm-bundler
@deiwee good idea, I've added the
schedule:runinstructions to the docs now.
@nebulon Hello, I added schedule:run command to crontab file:
* * * * * cd /app/data/public/ && sudo -u www-data /usr/bin/php /app/data/public/artisan schedule:run
restarted app but it still not working
If I run schedule commands manually, it works. Any suggestions?
@deiwee This combination worked for me:
* * * * * /usr/bin/php /app/data/public/artisan schedule:run
@deiwee I guess you would want to run it as www-data user though to not mess with file permissions. Did you get any error messages in the log? Of course after app restart it will always take at most a minute to kick the cron according to schedule.