Error when running: 'node -v'. Is Node.js available during analysis?

I’m attempting to integrate Node.js into my Jenkins server to enhance my pipeline capabilities. Specifically, I want to utilize Node.js for various tasks within my Jenkins pipelines, such as running JavaScript-based tests or build scripts.

Despite successfully installing Node.js version 16.20.2 both globally on the server and within my Jenkins instance, I encounter an issue when running my Jenkins pipeline. The error message received is:

Error when running: 'node -v'. Is Node.js available during analysis? org.sonar.plugins.javascript.nodejs.NodeCommandException

This error suggests that Node.js might not be accessible during the analysis stage of my pipeline, even though it’s installed and working on my system.

Additional Information:

  • Jenkins LTS version: 2.426.3
  • Node.js version: 16.20.2
  • Operating System: Amazon Linux 2

I’ve set the sonar.nodejs.executable property in my sonar-project.properties, but it’s still unable to find the Node.js executable

What should I do? I’m seeking guidance on resolving this issue and ensuring Node.js is properly available during the analysis stage of my Jenkins pipeline. Any insights or suggestions would be greatly appreciated.

Several posts below

1 Like

/opt/sonar-scanner/jre/lib/jspawnhelper has already executable permission still getting the same error

Check if all other files also have +x permission in sonar-scanner directory

find . -type f -executable -print
./jre/lib/jspawnhelper
./jre/bin/java
./bin/sonar-scanner
./bin/sonar-scanner-debug

All of these files got executable permission

Hi,

What’s your SonarQube version? And can we have the full analysis log?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Thx,
Ann