SonarLint not finding Node via Volta?

  • Operating system: macOS Sonoma 14.2.1
  • SonarLint plugin version: 10.2.1.77304
  • Programming language you’re coding in: TypeScript
  • Is connected mode used: No

And a thorough description of the problem / question:

The TypeScript section of WebStorm is able to find the Node interpreter managed via Volta:

SonarLint complains it can’t find Node though.

I saw NodeJsHelper was using /usr/libexec/path_helper and the Volta node shim should be on the path. I think it might be failing because the cwd when checking for node would need to be the project directory as the Volta shim inspects the relative package.json to work out which Node to give access to.

I can enter the manual path to the shim (~/.volta/bin/node) in SonarLint when prompted but, because it’s not being requested from the context of the project directory, the wrong Node version shows up. The SonarLint dialog will show it found v21 - the Volta default - rather than v20 - the project-specific version.

Any chance this could be improved in SonarLint?

Hi @liam, thank you for your report, and I apologize for the late reply. I was unaware of this tool that provides per-project configuration. We are not currently supporting this, so I created this improvement ticket.

However, this should not be a problem for you. Node.js is only used in SonarLint for the analysis of JS/TS/CSS, and we require Node.js >= 14.20 (Node.js >= 16 is recommended). The version does not matter as long as it fits the requirements so that you can keep the Volta’s default Node.js version in your case; it won’t make a difference.

Thanks Nicolas!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.