I’m running Jenkins on Windows and currently building a C# project the project builds fine and the scanning occurs. But I’m noting that it complains about not being able to find node.
ERROR: 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?
Node is installed on the machine and in the system path at C:\nodejs. I have been looking at this thread
Using that thread I updated my Jenkins command line to read:
But I’m getting: Unrecognized command line argument: -Dsonar.css.node=C:\nodejs in the logs. I’m not too bothered about css analysis, mainly it’s for JavaScript, so I also tried
Getting version 'C9918' to 'C:\Jenkins\workspace\INFP'...
Finished getting version 'C9918'. Retrieved 3457 resources. [INFP] $ C:\Jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\SonarMSB46\SonarScanner.MSBuild.exe begin /k:INFP /n:INFP /v: /d:sonar.host.url=[http://localhost:9000](http://localhost:9000/) ******** sonar.nodejs.executable=C:\nodejs
SonarScanner for MSBuild 4.6.2
Using the .NET Framework version of the Scanner for MSBuild Pre-processing started. Preparing working directories...
11:48:17.949 11:48:17.949 Unrecognized command line argument: sonar.nodejs.executable=C:\nodejs
11:48:17.949 Expecting at least the following command line argument: - SonarQube project key
Can you confirm that you get the same error message please? I think specifying a property in that form should be accepted by the Scanner for MSBuild, even if it isn’t handled by a plugin.
INFO: Using Node.js executable C:\nodejs from property sonar.nodejs.executable.
INFO: Sensor ESLint-based SonarJS [javascript] (done) | time=4313ms
INFO: Sensor C# Properties [csharp]
ERROR: Error when running: ‘C:\nodejs -v’. Is Node.js available during analysis?
org.sonarsource.nodejs.NodeCommandException: Error when running: ‘C:\nodejs -v’. Is Node.js available during analysis?
at org.sonarsource.nodejs.NodeCommand.start(NodeCommand.java:77)
at org.sonarsource.nodejs.NodeCommandBuilderImpl.getVersion(NodeCommandBuilderImpl.java:171)
at org.sonarsource.nodejs.NodeCommandBuilderImpl.checkNodeCompatibility(NodeCommandBuilderImpl.java:144)
at org.sonarsource.nodejs.NodeCommandBuilderImpl.build(NodeCommandBuilderImpl.java:120)
at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.initNodeCommand(EslintBridgeServerImpl.java:129)