Incorrect warning about incompatible node version

Since a picture’s worth 1000 words:

TL;DR: It’s complaining about my node version even though every copy of Node on my computer is a new enough version (v20 vs the v18 it’s asking for). I’m also using the VSCode setting to tell it which node to look at, and that node copy is on the PATH, so either way, it should be able to find it.

This is the same problem as Complaint that Node.js runtime >= v8.0.0 is Required (But is Installed) and Issue with Node environment for Sonarlint, except that those warnings were fixed with the setting, and my warning isn’t. It is also related to Invalid Node.js version warning, but that was a documentation issue.

Here are the logs from the Output panel. Now that I’m looking at them, two interesting things I notice: 1) It doesn’t complain about the node version for Python files, only JSON ones, and 2) It’s not actually that it’s finding node and mistaking its version, it’s that it can’t run the check for some reason (Unable to query node version).

Executing /Users/Katie/.vscode/extensions/sonarsource.sonarlint-vscode-4.5.1-darwin-x64/jre/21.0.3-macosx-x86_64.tar/bin/java -jar /Users/Katie/.vscode/extensions/sonarsource.sonarlint-vscode-4.5.1-darwin-x64/server/sonarlint-ls.jar -stdio -analyzers /Users/Katie/.vscode/extensions/sonarsource.sonarlint-vscode-4.5.1-darwin-x64/analyzers/sonargo.jar /Users/Katie/.vscode/extensions/sonarsource.sonarlint-vscode-4.5.1-darwin-x64/analyzers/sonarjava.jar /Users/Katie/.vscode/extensions/sonarsource.sonarlint-vscode-4.5.1-darwin-x64/analyzers/sonarjs.jar /Users/Katie/.vscode/extensions/sonarsource.sonarlint-vscode-4.5.1-darwin-x64/analyzers/sonarphp.jar /Users/Katie/.vscode/extensions/sonarsource.sonarlint-vscode-4.5.1-darwin-x64/analyzers/sonarpython.jar /Users/Katie/.vscode/extensions/sonarsource.sonarlint-vscode-4.5.1-darwin-x64/analyzers/sonarhtml.jar /Users/Katie/.vscode/extensions/sonarsource.sonarlint-vscode-4.5.1-darwin-x64/analyzers/sonarxml.jar /Users/Katie/.vscode/extensions/sonarsource.sonarlint-vscode-4.5.1-darwin-x64/analyzers/sonarcfamily.jar /Users/Katie/.vscode/extensions/sonarsource.sonarlint-vscode-4.5.1-darwin-x64/analyzers/sonartext.jar /Users/Katie/.vscode/extensions/sonarsource.sonarlint-vscode-4.5.1-darwin-x64/analyzers/sonariac.jar /Users/Katie/.vscode/extensions/sonarsource.sonarlint-vscode-4.5.1-darwin-x64/analyzers/sonarlintomnisharp.jar
[Info  - 10:57:38.887] SonarLint backend started, instance=org.sonarsource.sonarlint.core.rpc.impl.SonarLintRpcServerImpl@67d18ed7
[Info  - 10:57:39.623] Skipping text document analysis because workspace folder is not synchronized yet "file:///Users/Katie/Documents/Sentry/sentry/src/sentry/event_manager.py"
[Info  - 10:57:51.687] Started embedded server on port 64121
[Warn  - 10:58:05.377] Unable to query node version
[Warn  - 10:58:05.377] Configured Node.js could not be detected, please check your configuration in the SonarLint settings
[Info  - 10:58:08.514] Skipping text document analysis because workspace folder is not synchronized yet "file:///Users/Katie/Documents/Sentry/sentry/src/sentry/event_manager.py"
[Info  - 10:58:08.616] Analyzing file "file:///Users/Katie/Documents/Sentry/sentry/src/sentry/event_manager.py"...
[Info  - 10:59:42.188] Found 5 issues
[Info  - 10:59:42.189] Analyzing file "file:///Users/Katie/Documents/Sentry/sentry/src/sentry/event_manager.py"...
[Info  - 10:59:43.109] Found 5 issues
[Info  - 10:59:43.109] Analyzing file "file:///Users/Katie/Documents/Sentry/sentry/src/sentry/event_manager.py"...
[Info  - 10:59:44.000] Found 5 issues
[Info  - 10:59:44.001] Analyzing file "file:///Users/Katie/Documents/Sentry/sentry/src/sentry/event_manager.py"...
[Info  - 10:59:44.782] Found 5 issues
[Info  - 10:59:44.782] Analyzing file "file:///Users/Katie/Documents/Sentry/sentry/src/sentry/event_manager.py"...
[Info  - 10:59:45.464] Found 5 issues
[Info  - 10:59:45.464] Analyzing file "file:///Users/Katie/Documents/Sentry/sentry/src/sentry/event_manager.py"...
[Info  - 10:59:46.196] Found 5 issues
[Info  - 10:59:46.196] Analyzing file "file:///Users/Katie/Documents/Sentry/sentry/src/sentry/event_manager.py"...
[Info  - 10:59:46.839] Found 5 issues
[Info  - 11:56:39.804] Analyzing file "file:///Users/Katie/Documents/Sentry/sentry/src/sentry/sentry_metrics/consumers/indexer/batch.py"...
[Info  - 11:56:40.780] Found 1 issue
[Info  - 12:05:40.646] Analyzing file "file:///Users/Katie/Documents/Sentry/sentry/src/sentry/sentry_metrics/consumers/indexer/batch.py"...
[Info  - 12:05:41.348] Found 1 issue
[Info  - 12:14:50.436] Analyzing file "file:///Users/Katie/Documents/Sentry/sentry/.github/workflows/shuffle-tests.yml"...
[Warn  - 12:14:50.606] Node.js runtime version 18.17.0 or later is required.
[Info  - 12:14:50.609] Found 0 issues
[Info  - 12:16:36.874] Analyzing file "file:///Users/Katie/Documents/Sentry/sentry/package.json"...
[Warn  - 12:16:37.140] Node.js runtime version 18.17.0 or later is required.
[Info  - 12:16:37.140] Found 0 issues
[Info  - 12:17:23.426] Analyzing file "file:///Users/Katie/Documents/Sentry/sentry/.volta.json"...
[Warn  - 12:17:23.569] Node.js runtime version 18.17.0 or later is required.
[Info  - 12:17:23.570] Found 0 issues
  • Operating system: OSX 14.4.1
  • SonarLint plugin version: 4.5.1
  • VSCode version: 1.89.1
  • Programming language you’re coding in: JSON
  • Is connected mode used: No

Hi @lobsterkatie :wave:

Thanks so much for such a detailed post, it was very clear to follow :bowing_woman:

One thing that I see from the logs is that the SonarLint setting you have provided is not taken into account, and SonarLint tries to detect the node version all by itself. Usually, when the sonarlint.pathToNodeExecutable setting is taken into account, logs should include a line like Node.js path provided by configuration: /Users/Katie/.volta/bin/node.

the fact that the error is only shown for JSON and not Python files is expected since Node.js is a requirement only for SonarJS analyzer (JSON, YAML, TS, JS, etc… file analysis).

From your screenshot, it seems like you are using VSCode settings sync like this user. So, it could be that we have a problem properly handling synced settings :woman_shrugging: Could you please confirm that is the case? Or whether there is anything “special” in your setup?

I will try to set up settings sync on my side and reproduce the issue.
All the best,
Sophio

Hey, I am using the Enterprise SonarQube 9.9 LTS version.
I am also getting the same issue in latest SonarLint and node version automatically taken by sonarlint “/Users/zorro/.nvm/versions/node/v18.20.2/bin”

I am getting this error in all the file extensions.

[Info  - 17:12:35.345] Skipping text document analysis because workspace folder is not synchronized yet "file:///Users/zorro/Workspace/Demo/api.js"
[Info  - 17:15:18.625] Skipping text document analysis because workspace folder is not synchronized yet "file:///Users/zorro/Workspace/Demo/api.java"

Hi @zorro,

Based on the log lines you’ve provided, this looks like a different question to me. Please create a new thread with all your details.

 
Ann