Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

SonarLint in VS Code cannot analyze JavaScript or TypeScript files

Errorsonarlint failed to analyze javascript code

Short answer

JavaScript and TypeScript analysis needs a supported Node.js: 22.12.0 or newer on the 22 line, or 24.0.0 or newer on the 24 line. Other majors such as 23 are not supported. Install a supported version and point the sonarlint.pathToNodeExecutable setting at that node binary.

  • Applies to VS Code, SonarQube for VS Code (SonarLint), Node.js 22.12 and 24
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Find out which Node.js the shell and VS Code can see, and compare it with the supported ranges.

    node -v
    which node
  2. 2Match what you see, then jump to its fix

    1. 1node -v prints something outside 22.12 and later 22.x or 24.0 and later, for example v23, v20 or v22.11The Node.js on the PATH is not a supported versionFix
    2. 2node -v in your terminal is fine, but analysis still failsThe extension found a different Node.js than the one you meantFix

What does the error look like?

  • sonarlint failed to analyze javascript code
  • JS and TS files get no SonarLint findings, while other languages work

Cause 1 of 2

The Node.js on the PATH is not a supported version

1Check

The extension's requirements page names two supported lines for JS, TS and CSS analysis, and says other major versions are not supported.

node -v

2Fix

Install a supported Node.js, for example with nvm, and use it as the default.

nvm install 24
nvm alias default 24

3Verify

Restart VS Code from a terminal where node -v prints the new version, then open a JS file.

node -v
code .

Confirmed by docs.sonarsource.com

Did this fix it?

Cause 2 of 2

The extension found a different Node.js than the one you meant

1Check

The extension tries to locate Node.js on its own; you can set the location by hand.

echo $PATH && which -a node

2Fix

Set the path explicitly in settings.json, to a supported node binary.

{
  "sonarlint.pathToNodeExecutable": "/home/yourname/.nvm/versions/node/v24.0.0/bin/node"
}

3Verify

Reload the VS Code window and open a JavaScript file; findings should appear.

# VS Code: Developer: Reload Window

Confirmed by docs.sonarsource.com

Did this fix it?

How do I stop it coming back?

  • Keep to Node.js LTS lines when you pick a runtime. Node.js documents that odd-numbered releases such as 23 stop being supported after six months.
  • Pin the node path in settings when you manage several versions with nvm.
  • Recheck the requirements page after upgrading Node.js or the extension, since the supported ranges move.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

cdk synth says --app is required

--app is required either in command-line, in cdk.json or in ~/.cdk.json

The CDK CLI needs a command that runs your app and finds it in three places: the --app option, cdk.json in the project folder, or cdk.json in your home folder.

3 causes, each with a fix

Back end

The AWS SDK in Node.js cannot find any credentials

Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1

The AWS SDK walks a fixed credential chain: code, environment variables, the shared files in ~/.aws, then role sources such as ECS or EC2.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.