SonarLint doesn't find Node.js even though NODE_PATH is set

Hi all,

I’m using nvm and I’ve set the following env var in my .zshrc:

export NODE_PATH=`nvm which current`

However, SonarLint doesn’t pick up the path to Node.js; I have to manually set it in the plug-in’s Preferences screen.

Any suggestions how to make it work automagically? :slight_smile:
I didn’t see any explanation in the docs how the plug-in is trying to discover node… :confused:

Cheers,
Christian

  • Operating system: MacOS
  • SonarLint plugin version: 10.2.0.77238

Hi @christian.b,

Tobias from SonarLint for Eclipse here as I was the one implementing it for all our IDEs shared:

Did you add the folder containing the node executable to $PATH (e.g. via your .zshrc)?
On macOS (and Linux) we are running the following command to find Node.js executable(s):

/usr/bin/which node

So we are not picking up NODE_PATH at all and solely rely on the path variable. To construct the $PATH variable we are using the /usr/libexec/path_helper utility.
When you add Node.js to the path variable it should be found after a restart, otherwise you have to configure it manually in the preferences.

One additional hint: When you run IntelliJ not in the user context, the Node.js installation will also not be found (even when adding it to the path variable).

Hope that helps,
Tobias