Sonar scanner integrated into Gitlab CI/CD has an error with the node version incompatibility

Sonar-scanner version 5.0.1.3006

Sonar scanner integrated into Gitlab CI/CD has an error with the node version incompatibility.

ERROR: Error during SonarScanner execution
216java.lang.IllegalStateException: Error while running Node.js. A supported version of Node.js is required for running the analysis of JS/TS files. Please make sure a supported version of Node.js is available in the PATH or an executable path is provided via ‘sonar.nodejs.executable’ property. Alternatively, you can exclude JS/TS files from your analysis using the ‘sonar.exclusions’ configuration property. See the docs for configuring the analysis environment

Caused by: org.sonar.plugins.javascript.nodejs.NodeCommandException: Unsupported Node.JS version detected 16.17. Please upgrade to the latest Node.JS LTS version.

I compared it to the pipeline that passed and found out that it also uses the same version of node (v16.17.0).

I’m not sure if this is related but I also checked this error both on failed and passed pipelines.

ERROR: /home/bitnami/.sonar/js/node-runtime/node: /lib/x86_64-linux-gnu/libm.so.6: version GLIBC_2.27' not found (required by /home/bitnami/.sonar/js/node-runtime/node) 120ERROR: /home/bitnami/.sonar/js/node-runtime/node: /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.28’ not found (required by /home/bitnami/.sonar/js/node-runtime/node)
121ERROR: /home/bitnami/.sonar/js/node-runtime/node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25’ not found (required by /home/bitnami/.sonar/js/node-runtime/node)

I tried to resolve it by adding this configuration to the sonar-scanner config file but still failed.

sonar.nodejs.executable=/home/bitnami/.nvm/versions/node/v16.17.0/bin/node

File location: /sonar-scanner-5.0.1.3006-linux/conf/sonar-scanner.properties

Content of sonar-scanner.properties

#----- Default SonarQube server
#sonar.host.url=http://localhost:9000
sonar.host.url=https://sonarcloud.io
sonar.login=****
sonar.nodejs.executable=/home/bitnami/.nvm/versions/node/v16.17.0/bin/node
#----- Default source code encoding
#sonar.sourceEncoding=UTF-8

Template for a good new topic, formatted with Markdown:

  • ALM used (GitHub, Bitbucket Cloud, Azure DevOps)
  • CI system used (Bitbucket Cloud, Azure DevOps, Travis CI, Circle CI
  • Scanner command used when applicable (private details masked)
  • Languages of the repository
  • Only if the SonarCloud project is public, the URL
    • And if you need help with pull request decoration, then the URL to the PR too
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
  • Steps to reproduce
  • Potential workaround

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hey there.

NodeJS 18.17 is the minimum supported version when you have to provide your own NodeJS binary.

Probably, the build agent or the docker image you’re running on doesn’t support this version of NodeJS. What’s the environment of your build like?