A supported version of Node.js is required for running the analysis of JS in HTML files

hi Sonar Team
Soanrscan is being run in github action with self-host, but we have come across an issue recently only with some maven services. This is the error code:

Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.10.0.2594:sonar (default-cli) on project eras-lor-service: Error while running Node.js. A supported version of Node.js is required for running the analysis of JS in HTML 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 in HTML files from your analysis using the ‘sonar.exclusions’ configuration property. See the docs for configuring the analysis environment: https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/languages/javascript-typescript-css/: Unsupported Node.JS version detected 16.18.1. Please upgrade to the latest Node.JS LTS version. → [Help 1]

I have added exclustions as suggested, but I am still experiencing the same problem.

COVERAGE_EXCLUSTIONS: /*.js,/.jsx,**/.cjs,/*.mjs,/.vue,**/.ts,/*.tsx,/.cts,**/.mts,/*.html,/.htm,**/.yaml

This is the soanrscan code we are using in github action:

The current version in self-host of NodeJS is 16.18.1

My questions are:

  • Why does this problem occur only in certain Maven services, rather than all of them, if the NodeJS version is unsupported.
  • If the NodeJS cannot be upgraded due to some reasons, how to resolve this issue?

Thank you

Hi,

First, coverage exclusions doen’t exclude files from analysis, they only exclude them from being part of coverage calculations.

Node 16.* is well past end of life. That’s part of why we stopped supporting it for analysis. I urge you to upgrade to a supported version immediately. Either that, or you could try just uninstalling it. For most architectures, analysis delivers a supported version of Node.js and uses it natively.

It’s hard to know without knowing more about your architecture and environment. Maybe the projects that are successfully analyzed don’t have any relevant files? Maybe those projects use full/analysis exclusions, rather than coverage exclusions? Maybe the build agents those projects run on have a supported version (or no version) of Node.js installed.

Exclude the files from analysis altogether.

 
HTH,
Ann

HI Ann
Thank you for your quick response! we are currently using self-host runner to run our sonarscan on github, and we can’t uninstall the nodejs since it is required for other services which are using the same host.
The documation we were trying is for sonarqube, do you know how to do it in soanrcloud ?
if i want to add analysis exclusions by using soanr maven pluging CLI. which argument should i use, instead of using converage exclusion? thank you

Hi,

Can you upgrade it to a non-EOL version?

Oops. Looks like I linked to the SonarQube docs by mistake. Sorry about that. Here are the SonarCloud docs.

As stated earlier, you should use file exclusions.

 
HTH,
Ann