puma / puma-dev

A tool to manage rack apps in development with puma
BSD 3-Clause "New" or "Revised" License
1.74k stars 107 forks source link

Linux: Rails app fails to start with sh: yarn: command not found #249

Closed goshatch closed 4 years ago

goshatch commented 4 years ago

Hello, I'm having an issue running a Rails 5.2.4.3 app with puma-dev on Linux (Arch). Please see below for the command output:

$ puma-dev -sysbind -debug
2020/06/01 14:39:18 Existing valid puma-dev CA keypair found. Assuming previously trusted.
* Directory for apps: /home/gueorgui/.puma-dev
* Domains: test
* HTTP Server port: 80
* HTTPS Server port: 443
! Puma dev listening on http and https
2020-06-01T14:39:22.527379904+01:00: GET '/controller/1/action' (host=admin.myapp.test)
! Booting app 'myapp' on socket /home/gueorgui/.puma-dev/myapp/tmp/puma-dev-743559.sock
myapp[743787]: Puma starting in single mode...
myapp[743787]: * Version 3.12.6 (ruby 2.6.5-p114), codename: Llamas in Pajamas
myapp[743787]: * Min threads: 0, max threads: 5
myapp[743787]: * Environment: development
myapp[743787]: sh: yarn: command not found
myapp[743787]:
myapp[743787]:
myapp[743787]: ========================================
myapp[743787]:   Your Yarn packages are out of date!
myapp[743787]:   Please run `yarn install --check-files` to update.
myapp[743787]: ========================================
myapp[743787]:
myapp[743787]:
myapp[743787]: To disable this check, please change `check_yarn_integrity`
myapp[743787]: to `false` in your webpacker config file (config/webpacker.yml).
myapp[743787]:
myapp[743787]:
myapp[743787]:
myapp[743787]:
myapp[743787]:
myapp[743787]: ! Unable to load application: SystemExit: exit
! Killing 'myapp' (743787)
* App 'myapp' shutdown and cleaned up

Potentially relevant details:

Any clues as to what might be happening would be appreciated!

nonrational commented 4 years ago

This is likely related to your non-bash shell.

Will you try adding your nvm init snippet to a .env file in your application directory? That way, when the puma boot bash shell gets run, it'll load the node version which has yarn installed.

Let me know how that works out.

goshatch commented 4 years ago

@nonrational Thank you for your response! Your hunch about the .env file proved correct. Although adding my nvm init snippet to it didn't work, prepending $NVM_BIN to the PATH env variable in the .env did the trick.

Thanks again!

micdahl commented 1 year ago

Hi @goshatch! I ran into the same problem. Could you please explain, how you changed the .env exactly? Inserting PATH=$NVM_BIN:PATH did not work for me.