yarn: command not found

Answered

Hi everyone,

I have a new issue since I updated rails gem from 5.2.3 to 6.0.1

When I try to run rails in development mode with the navbar (top right) it just doesn't work, I have the following message :

/usr/bin/ruby /home/flo/Ruby/updatedRailsTest/bin/rails server -b 0.0.0.0 -p 3000 -e development
=> Booting Puma
=> Rails 6.0.1 application starting in development
=> Run `rails server --help` for more startup options
sh: yarn: command not found

========================================
Your Yarn packages are out of date!
Please run `yarn install --check-files` to update.
========================================


To disable this check, please change `check_yarn_integrity`
to `false` in your webpacker config file (config/webpacker.yml).

With some research on similar issue I found that is probably a PATH issue and I tried multiple fix but it doesn't work...

Because if I run "rails s" or "bundle exec rails s" or "yarn" in a normal terminal (or the embeded terminal in bottom of jetbrains IDE) there is no issues, but with the navbar it doesn't work

Best regards

N.B. sorry for my english, i'm french

6 comments
Comment actions Permalink

Hello Florent,

just to be sure, in case you launch RubyMine from the terminal does it work?

0
Comment actions Permalink

Hello,

I launched RubyMine via desktop shortcut (the script run a command like Exec="path_to/rubymine.sh"), but I solved the issue by running "sudo npm i -g yarn" I know that it's not a good practice to install npm package with sudo but for the moment it's ok for me.

 

0
Comment actions Permalink

I have the same problem...

There is another solution?

1
Comment actions Permalink

exact same problem...

0
Comment actions Permalink

Basically normally doing Ruby, I have to use Rails for a project, and face, again, the same kind of weird path issue (I say path cos' it's probably that...)

  • Running the rails app from command line: OK
  • Running the rails app from the embedded terminal within RM: OK
  • Running the rails app from the rails task (execution configuration), having started RM from command line: OK
  • Running the rails app from the rails task (execution configuration), having started RM from launch icon: KO

I did check every possible path coming to my mind within RM (SDK, node, npm/yarn), all of them seem correct.

What can I do to ensure my environment behaves consistently within and outside of RM ?

Olga Kuvardina I see this ticket as being flagged `answered`, but I really do not feel like it is.

--
Build #RM-201.7846.78, built on June 2, 2020

0
Comment actions Permalink

I think I came to the root of the problem. This is for the Linux version but I guess the issue/resolution is almost the same for other platforms.

First how to solve the issue: You just need to have the node directory in the PATH variable before RM is started... So for me in order to keep the `rubymine.sh` start script untouched to avoid issues when updating, I basically just created a wrapper around to prepend the bin folder of my node installation to the PATH variable, and modified the .desktop file to use that new script instead of the original `rubymine.sh`. As the original `rubymine.sh` uses '/bin/sh' as shell (ie dash on Ubuntu) none of my usual user-level environment variables are set, thus the issue...(including PATH).

So that or any other solution ensuring the path is correctly set before starting RM will fix the issue.

Olga Kuvardina But there is something nevertheless inconsistent in the sense that in RM settings, we explicitly specify the path to where node is actually installed. Thus there should be no need to have it explicitly in the PATH.

Using `/bin/sh` as startup shell sounds pretty sane but then you cannot expect the environment to be the same as the bash/zsh/xxxsh shell the user actually uses, meaning that RM should recreate an environment when executing commands generated from its settings (in that case prepend the path entered in the RM settings for node to the PATH environment variable before executing external commands).

 

0

Please sign in to leave a comment.