Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Cloudron Forum

Apps | Demo | Docs | Install

LAMP Laravel and npm

Scheduled Pinned Locked Moved Solved LAMP
7 Posts 2 Posters 380 Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DeiWee
    wrote on last edited by
    #1

    Hello,

    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/

    1 Reply Last reply
    0
  • nebulonN Offline
    nebulonN Offline
    nebulon Staff
    wrote on last edited by
    #2

    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

    D 1 Reply Last reply
    1
  • D Offline
    D Offline
    DeiWee
    replied to nebulon on last edited by
    #3

    @nebulon Thanks, this worked!

    Note that you have to be in /app/data/public/ catalog with root.

    In this guide https://docs.cloudron.io/guides/lamp-laravel/ would be great to include schedule:run cron too.

    nebulonN 1 Reply Last reply
    0
  • nebulonN Offline
    nebulonN Offline
    nebulon Staff
    replied to DeiWee on last edited by
    #4

    @deiwee good idea, I've added the schedule:run instructions to the docs now.

    D 1 Reply Last reply
    0
  • D Offline
    D Offline
    DeiWee
    replied to nebulon on last edited by
    #5

    @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?

    D 1 Reply Last reply
    0
  • D Offline
    D Offline
    DeiWee
    replied to DeiWee on last edited by
    #6

    @deiwee This combination worked for me:

    * * * * * /usr/bin/php /app/data/public/artisan schedule:run
    

    Regards.

    nebulonN 1 Reply Last reply
    0
  • nebulonN Offline
    nebulonN Offline
    nebulon Staff
    replied to DeiWee on last edited by
    #7

    @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.

    1 Reply Last reply
    0

  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Login

  • Don't have an account? Register

  • Login or register to search.