Linux: Rails app fails to start with sh: yarn: command not found
goshatch opened this issue · comments
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:
- I'm managing my node versions through
nvm
and am currently usingv12.16.1
which I think is the current LTS. - My shell is
fish
. - Starting the app in the normal way (via
bundle exec rails s
) works fine with regards toyarn
. - If I set
check_yarn_integrity: false
in my webpacker configuration, this particular error does not happen anymore and the app boots up fine. - The error happens both when I start
puma-dev
as a systemd service, and when I launch it manually from my app directory.
Any clues as to what might be happening would be appreciated!
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.
@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!
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.