Skip to content

NodeJS prerequisite for JavaScript and TypeScript analysis

duncanp-sonar edited this page Aug 30, 2022 · 11 revisions

Sonar’s JavaScript and TypeScript analyzers require specific Node.js versions to be installed on the machine. If no compatible version is found, the analysis will not be performed. See the table below for minimal required Node.js version per SonarLint version:

SonarLint for Visual Studio Version Minimal Required Node.js Version
v6.7 and earlier Node.js v10 and higher, excluding Node.js v11
v6.8 Node.js v12.22 and higher

Auto-detection of compatible Node.js versions

SonarLint for Visual will attempt to locate a compatible Node.js version on the machine by searching on the %PATH%. It will also check whether there is a Node.js installation as part of the current Visual Studio installation.

If SonarLint cannot find a compatible Node.js version, it will show a notification in a gold bar like the following:

TODO

The Output Window will contain additional information about the Node.js versions that were located.

Manually specifying a custom location of Node.js installation

You can also set the environment variable SONAR_NODEJS_PATH to specify a custom location. The value should be the full file path to the node executable e.g. c:\custom\node.exe. The environment variable takes precedence over the automatic detection. You will need to restart Visual Studio after setting or changing the environment variable.

Installing Node.js

If the machine does not have a compatible version of Node.js, you can manually install one. Node.js versions can be downloaded from the official website nodejs.org. The simplest installation method on Windows is to use the appropriate .msi.

Clone this wiki locally