Jenkins + Nodejs (docker?)

We’re getting the following error in our logs, which is accurate:

ERROR: CSS rules were not executed. Error when running: 'node -v'. Is Node.js available during analysis?
org.sonarsource.nodejs.NodeCommandException: Error when running: 'node -v'. Is Node.js available during analysis?

Is there someway to bundle nodejs with sonar-scanner? Our Jenkins nodes are pretty bare-bones. We use containers for everything, including node builds. We do not install build tools on the instance itself. How can we point to an internal nodejs? Or use a docker container?

Configuration info:

INFO: SonarScanner 4.3.0.2102
INFO: Java 1.8.0_211 Oracle Corporation (64-bit)
INFO: Linux 4.15.0-42-generic amd64
INFO: User cache: /home/vcap/.sonar/cache
INFO: SonarQube server 8.3.1

Hi Philip,

Welcome to the community!

There is indeed a docker image for the sonar-scanner that bundles node.js. Please note that this is not yet considered an official image and we welcome feedback on your experiences utilizing it, should you choose to!

1 Like

Hi Philip,

No we currently don’t bundle NodeJS with the scanner, I’m not even sure this is possible. The easiest solution would be to install NodeJS on the Jenkins nodes that perform the scan, or as Jeff mentioned, use the Sonar Scanner Docker image.

Cheers,
Mark

Thanks, Jeff. I do like this approach more. We’ll look into this route.

@Mark_Rekveld Got it. I was thinking in terms of packages with sonar plugin, but you’re right, Jeff’s approach is the better route.