Node Interpreter: node (No executable found in $PATH)

Answered

Trying to execute simple JaveScript code in IntelliJ IDEA:

 

 

 

When I try to run it brings up the Edit configuration window.

 

I click on the ... and then the + sign to add a local, but I can't find the node.

I do have the Node.js and Node.js Remote Interpreter plugins installed and enabled.

My IDEA application installed in the default location: /usr/local/bin/

But I can't see node there.

I can see the hidden files.

How might I be able to find the node?

 

I also have a similar error when trying to use the "JavaScript for Beginners" course on for the Learn and Teach plugin.

Your help is greatly appreciated!

0
15 comments

You need to install node.js itself and have a binary on the system that you can run from the terminal: https://nodejs.org/en/ .

1

Thank you Serge!

I really appreciate it!

The code runs.

For others out there, I went to the link above, clicked on one of the downloads, installed it.

It showed the default location as /usr/local/bin/node and I accepted.

Once it finished installing, I checked the Languages and Frameworks for Node.js and NPM and it had already updated the Node interpreter with the file path. 

0

If it works with the regular installer, it means Webstorm is incompatible with NVM. Node is installed via NVM and on the PATH, but Webstorm has some sort of dependency on the official installer.

2

@Jason Tiscione No, it doesn't seem to have any relation to having Node.js installed with NVM

0

The problem I'm having is that all the features in the Run menu are broken.

Node is on the PATH. If I open up the Terminal tab and type "which node" it prints the location of the current executable in NVM. If I type echo $PATH I can see it. But if I create a node or npm run target, the "Node Interpreter" dropdown says "node: NO EXECUTABLE FOUND IN PATH".

So I try specifying the absolute path to the NVM folder's node executable in the dropdown instead. But if I try to run it, it still crashes and complains that node is not on the PATH:

"/home/jason/.nvm/versions/node/v12.18.0/bin/node /home/jason/.nvm/versions/node/v12.18.0/lib/node_modules/npm/bin/npm-cli.js start
npm WARN lifecycle npm is using /home/jason/.nvm/versions/node/v12.18.0/bin/node but there is no node binary in the current PATH."

/usr/bin/env: ‘node’: No such file or directory
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! the-nextjs-starter@1.0.0 start: `nodemon server.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the the-nextjs-starter@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/jason/.npm/_logs/2020-07-09T18_39_03_936Z-debug.log

Process finished with exit code 1

So I try copy/paste of the command line that Webstorm claims to be running. It works with no problems, both inside and outside Webstorm's terminal. So this is obviously a bug in Webstorm.

I tried downgrading to 2019.3.3 but that version is also broken.

4

Try starting WebStorm from terminal using bin/webstorm.sh - does the issue persist?

When being launched from desktop/System menu/Toolbox, WebStorm only sees environment variables configured in login shell, but not in interactive shell configuration files (like .bashrc or .zshrc). Possible solutions:

  • Workaround 1: make required variables available in a login shell by moving them to the corresponding shell profile config
  • Workaround 2: run IDE from a terminal to make it inherit terminal environment

see also https://youtrack.jetbrains.com/issue/IDEABKL-7589

0

Workaround 1 is not possible with NVM, since it makes its changes to .bashrc.

Workaround 2 does work- if I actually type in "/bin/sh /home/jason/.local/share/JetBrains/Toolbox/apps/WebStorm/ch-0/201.8538.32/bin/webstorm.sh" it works correctly. But that makes Toolbox seem pretty useless.

0

So no other solutions?

0
ln -s "$(which node)" /usr/local/bin/node

The command will create a symlink from the current node version you have installed. If there is already a /usr/local/bin/node file, delete that since it might be a broken link. 

Also change in Edit Configuration from whatever project version you have to "node" (which will be the link created with the above command)

3

I'm using nvm and zsh. Coping the values

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

to `~./profile` worked. My `~./zshrc` and `~./bashrc` do not have the export and I'm using the self created desktop entry from Intellij. Session restart was required.

4

The solution from 20110669 works well. Since I have many more items in my profile. I added the following to the end of my ~/.profile. Is this documented somewhere? Would be good to change this or at least know which files are sourced since the built-in terminal and run configurations do not use the exact same environment.

source .bash_profile
0

Also if you install IDE (in my case PhpStorm) using Snap/Flatpack node wan't work. Snap/flatpack packaging systems are limiting IDE access to certain folders and files. It's recommended to use the official tar.gz distribution to avoid such limitations.

0

Sorry for the potentially stupid question -- do I have to run the command to create a symlink every time I update/upgrade node with my version manager?

0

Yeah, 20110669's solution (in my case moving those 3 lines from ~/.bashrc to ~/.profile) solved the problem.

0

Please sign in to leave a comment.