Fixing missing NVM Node for RubyMine

I have Rubymine installed locally. Recently for work, I had to install NVM in a new machine. However when I then load Rubymine on this new machine and start a task such a Rails project using the Configuration pane, I was treated with following error

.../.rvm/gems/ruby-2.4.10/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect': Could not find a JavaScript runtime. See for a list of available runtimes. (ExecJS::RuntimeUnavailable)

So basically it can’t find the NVM JavaScript runtime.

After digging a bit further, I noticed that RubyMine is launched via /bin/dash. So it seems the same environment variable available in Bash shell was not available.

So my fix was:

Create /etc/profile.d/ (or something similar)

Put following content in the file

if [ -d "$HOME/.nvm" ] ; then
    export NVM_DIR="$HOME/.nvm"
    [ -s "$NVM_DIR/" ] && \. "$NVM_DIR/"
    [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

It is similar to the script mentioned in: I just check if the directory exists before running other commands. Basically it will set the add the NVM node path to PATH.

Add following line to .bashrc.

source "/etc/profile.d/"

Log out and login

Now when you start the configuration, it should work in Rubymine.

PS: If you know a better way to fix it, let me know.

0 0 vote
Article Rating

By Sinaru Gunawardena

Sinaru is a software developer at work and a painter in free time. He enjoys writing tech notes on his personal website. He currently lives in Dublin, Ireland.

Notify of
Inline Feedbacks
View all comments