Sonarlint still believe nodejs version 14.17.0 with flatpak version of VSCode

Please provide

  • Operating system: Manjaro
  • SonarLint plugin version: 4.1.0
  • Programming language you’re coding in: JavaScript
  • Is connected mode used: no (plugin)

And a thorough description of the problem / question:
When using OSS - VSCode (AUR) SonarLink works fine.
When using Visual Studio Code (flatpak) Sonarlint believe NodeJs is version 14.17.0
image

Even if command line (shell) give version 21.4.0

node -v                                                                                                                                                                                                       
v21.4.0

where node
/usr/bin/node

/usr/bin/node -v
v21.4.0

Tried to configure path on settings.json without success. Any idea to troubleshoot this problem?

{
    "workbench.colorTheme": "Default Dark Modern",
    "terminal.integrated.defaultProfile.linux": "bash",
    "terminal.integrated.profiles.linux": {
      /*"bash": {
        "path": "host-spawn",
        "args": ["bash"]
      },*/
      "zsh": {
        "path": "host-spawn",
        "args": [
            "--host",
            "--env=TERM=xterm-256color",
            "zsh"
        ]
      },
    },
    "workbench.iconTheme": "material-icon-theme",
    "sonarlint.pathToNodeExecutable": "/usr/bin/node",
    
}

I’m not able to modify defaultSettings.json

Hey there.

I’m not familiar with this distribution. Is this what you’re referring to? GitHub - flathub/com.vscodium.codium

Hello, would it be possible for you to enable verbose logs, restart your IDE, and share here an excerpt from the “SonarLint Output”?

This notification is shown when a well-known exception is thrown by the JS/TS analyzer; initially, it was thrown only when the Node.js runtime requirement was not met, but it might be used in other cases - and only the verbose logs can help us understand what is going on.

Well I’ve enable logs in my two IDE (the one, build for Manjaro and the another one as flatpak).
Here are the logs for flatpak version:

Executing /home/david/.var/app/com.visualstudio.code/data/vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/jre/21.0.1-linux-x86_64.tar/bin/java -jar /home/david/.var/app/com.visualstudio.code/data/vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/server/sonarlint-ls.jar -stdio -analyzers /home/david/.var/app/com.visualstudio.code/data/vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonargo.jar /home/david/.var/app/com.visualstudio.code/data/vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarjava.jar /home/david/.var/app/com.visualstudio.code/data/vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarjs.jar /home/david/.var/app/com.visualstudio.code/data/vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarphp.jar /home/david/.var/app/com.visualstudio.code/data/vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarpython.jar /home/david/.var/app/com.visualstudio.code/data/vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarhtml.jar /home/david/.var/app/com.visualstudio.code/data/vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarxml.jar /home/david/.var/app/com.visualstudio.code/data/vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarcfamily.jar /home/david/.var/app/com.visualstudio.code/data/vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonartext.jar /home/david/.var/app/com.visualstudio.code/data/vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonariac.jar /home/david/.var/app/com.visualstudio.code/data/vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarlintomnisharp.jar
[stderr] Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=lcd_hrgb -Dswing.aatext=true
[stderr] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[stderr] SLF4J: Defaulting to no-operation (NOP) logger implementation
[stderr] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Initializing file:///home/david/Documents/Temp/SIO1/Codes/GARAALI%20%28i%29 on branch undefined
[Debug - 16:50:52.635] Folder file:///home/david/Documents/Temp/SIO1/Codes/GARAALI%20%28i%29 is now on an unknown branch.
[Debug - 16:50:52.633] Fetching global configuration
[Debug - 16:50:52.657] Queuing analysis of file "file:///home/david/Documents/Temp/SIO1/Codes/GARAALI%20%28i%29/tp%201%20imc/Untitled-1.js" (version 1)
There is no git repository, consider all files as not ignored
[Debug - 16:50:52.661] Cached SCM ignore status for file "file:///home/david/Documents/Temp/SIO1/Codes/GARAALI%20%28i%29/tp%201%20imc/Untitled-1.js": Not ignored
[Debug - 16:50:53.734] Fetching configuration for folder 'file:///home/david/Documents/Temp/SIO1/Codes/GARAALI%20%28i%29'
[Debug - 16:50:53.737] Workspace folder 'WorkspaceFolder[name=GARAALI (i),uri=file:///home/david/Documents/Temp/SIO1/Codes/GARAALI%20%28i%29]' configuration updated: WorkspaceFolderSettings[analyzerProperties={sonar.cs.file.suffixes=.cs, sonar.cs.internal.useNet6=true, sonar.cs.internal.loadProjectOnDemand=false, sonar.cs.internal.loadProjectsTimeout=60},connectionId=<null>,pathToCompileCommands=,projectKey=<null>,testFilePattern=]
[Info  - 16:50:53.737] Analyzing file "file:///home/david/Documents/Temp/SIO1/Codes/GARAALI%20%28i%29/tp%201%20imc/Untitled-1.js"...
[Debug - 16:50:53.738] Global settings updated: WorkspaceSettings[connections={},disableTelemetry=false,excludedRules=[],focusOnNewCode=false,includedRules=[],pathToNodeExecutable=/usr/bin/node,ruleParameters={},showAnalyzerLogs=true,showVerboseLogs=true]
[Debug - 16:50:53.741] Analysis triggered with configuration:
[
  baseDir: /home/david/Documents/Temp/SIO1/Codes/GARAALI (i)
  extraProperties: {sonar.cs.file.suffixes=.cs, sonar.cs.internal.loadProjectsTimeout=60, sonar.cfamily.compile-commands=, sonar.cs.internal.useNet6=true, sonar.cs.internal.loadProjectOnDemand=false}
  moduleKey: file:///home/david/Documents/Temp/SIO1/Codes/GARAALI%20%28i%29
  excludedRules: []
  includedRules: []
  ruleParameters: {}
  inputFiles: [
    file:///home/david/Documents/Temp/SIO1/Codes/GARAALI%20%28i%29/tp%201%20imc/Untitled-1.js (UTF-8) [js]
  ]
]

[Debug - 16:50:53.741] Starting standalone SonarLint engine...
[Debug - 16:50:53.741] Using 11 analyzers
[Debug - 16:50:53.741] Default settings updated: WorkspaceFolderSettings[analyzerProperties={sonar.cs.file.suffixes=.cs, sonar.cs.internal.useNet6=true, sonar.cs.internal.loadProjectOnDemand=false, sonar.cs.internal.loadProjectsTimeout=60},connectionId=<null>,pathToCompileCommands=,projectKey=<null>,testFilePattern=]
[Debug - 16:50:53.760] Plugin 'JavaScript/TypeScript/CSS Code Quality and Security' requires Node.js 14.17.0. Skip loading it.
[Debug - 16:50:53.766] Loaded 10 plugins
[Debug - 16:50:53.766]   * C# Code Quality and Security (Omnisharp) 1.17.0.82356 (csharp)
[Debug - 16:50:53.766]   * Python Code Quality and Security 4.14.0.14263 (python)
[Debug - 16:50:53.766]   * CFamily Code Quality and Security 6.51.0.65468 (cpp)
[Debug - 16:50:53.766]   * Java Code Quality and Security 7.29.0.34131 (java)
[Debug - 16:50:53.766]   * HTML Code Quality and Security 3.9.0.3600 (web)
[Debug - 16:50:53.766]   * XML Code Quality and Security 2.10.0.4108 (xml)
[Debug - 16:50:53.767]   * Go Code Quality and Security 1.15.0.4655 (go)
[Debug - 16:50:53.767]   * PHP Code Quality and Security 3.33.0.11274 (php)
[Debug - 16:50:53.767]   * IaC Code Quality and Security 1.23.0.7263 (iac)
[Debug - 16:50:53.767]   * Text Code Quality and Security 2.7.1.1388 (text)
[Debug - 16:50:54.996] Creating container for module 'file:///home/david/Documents/Temp/SIO1/Codes/GARAALI%20%28i%29'
[Debug - 16:50:55.011] Standalone SonarLint engine started
[Debug - 16:50:55.056] Start analysis
[Info  - 16:50:55.071] Index files
[Debug - 16:50:55.072] Language of file "file:///home/david/Documents/Temp/SIO1/Codes/GARAALI%20%28i%29/tp%201%20imc/Untitled-1.js" is set to "JavaScript"
[Info  - 16:50:55.073] 1 file indexed
[Debug - 16:50:55.477] 'JavaSensor' skipped because there is no related files in the current project
[Debug - 16:50:55.477] 'OmniSharp' skipped because there is no related files in the current project
[Debug - 16:50:55.477] 'Python Sensor' skipped because there is no related files in the current project
[Debug - 16:50:55.477] 'IPython Notebooks Sensor' skipped because there is no related files in the current project
[Debug - 16:50:55.477] Execute Sensor: HTML
[Debug - 16:50:55.479] 'XML Sensor' skipped because there is no related files in the current project
[Debug - 16:50:55.479] 'Code Quality and Security for Go' skipped because there is no related files in the current project
[Debug - 16:50:55.479] 'PHP sensor' skipped because there is no related files in the current project
[Debug - 16:50:55.479] 'Analyzer for "php.ini" files' skipped because there is no related files in the current project
[Debug - 16:50:55.479] 'IaC Terraform Sensor' skipped because there is no related files in the current project
[Debug - 16:50:55.479] 'IaC CloudFormation Sensor' skipped because there is no related files in the current project
[Debug - 16:50:55.479] 'IaC Kubernetes Sensor' skipped because there is no related files in the current project
[Debug - 16:50:55.479] 'IaC AzureResourceManager Sensor' skipped because there is no related files in the current project
[Debug - 16:50:55.479] Execute Sensor: TextAndSecretsSensor
[Info  - 16:50:55.757] 1 source file to be analyzed
[Info  - 16:50:55.782] 1/1 source file has been analyzed
[Debug - 16:50:55.782] Execute Sensor: IaC Docker Sensor
[Info  - 16:50:55.784] 0 source files to be analyzed
[Info  - 16:50:55.825] 0/0 source files have been analyzed
[Debug - 16:50:55.826] 'CFamily' skipped because there is no related files in the current project
[Warn  - 16:50:55.827] Node.js runtime version 14.17.0 or later is required.
[Info  - 16:50:55.888] Found 0 issues

Hello, thanks for sharing the logs!

I don’t see anything suspicious here :thinking:

I’m not familiar with Flatpak, but if I recall correctly, one of its goals is to package apps as isolated as possible from the base OS, so it is highly possible that the Flatpak’ed VSCode does not “see” the system’s Node runtime at /usr/bin/node.

I found a similar question on SuperUser about access to Node in a Flatpak’ed WebStorm, maybe you can take inspiration from there and:

  • Run flatpak install org.freedesktop.Sdk.Extension.node20
  • Then add FLATPAK_ENABLE_SDK_EXT=node20 when running VSCode

Hope this helps!

Yes, I’ve tried different solution (especially around host-spawn and flatpak-spawn).
The system still hard to troubleshoot, without clear documentation and commands.
My final solution has been to uninstall flatpak version and install snap version: this last one worked like a charm and seems up to date (VSCode 1.85)
Thanks for your help (and have nice moments with your family for these days)

1 Like

Hey @droumanet, thanks for your kind wishes!

And thank you also for coming back and sharing what you’ve tried, this is invaluable to the community.

The whole team would appreciate it if you have two minutes to review SonarLint on the VSCode Marketplace :gift:

Enjoy coding with SonarLint, and please also let me wish you all the best for the end-of-year festivities :partying_face:

1 Like