My current task involves examining a TypeScript project on Jenkins using the SonarQube Scanner plugin on a Mac OS slave.
Software:
- Jenkins (version 2.32.1)
- SonarQube Scanner for Jenkins plug-in (version 2.5)
- SonarQube Scanner (version 2.8)
- SSH slave plug-in (version 1.12)
- SonarQube (version 6.7)
- SonarTS (version 1.1)
- Mac OS X (version 10.12.6)
Issue:
The SonarTS plugin attempts to initiate Node.js, but Node.js is not included in the PATH
variable, as indicated in the log:
Caused by: java.io.IOException: Cannot run program "node": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at org.sonar.plugin.typescript.ExternalTypescriptSensor.executeExternalRunner(ExternalTypescriptSensor.java:175)
Exploration:
I attempted to set up the path on my Mac through:
environment.plist
(from )However, this method no longer works.
/etc/launchd.conf
(from )This approach is also obsolete and ineffective.
/etc/paths.d/
(from )Unfortunately, this too did not resolve the issue (same error message).
I tried utilizing the existing paths (/usr/bin
, /bin
, /usr/sbin
, /sbin
) with:
a symbolic link
Regrettably, this method failed due to write-protection of the paths (even for an administrator).
I experimented with passing the path to the SonarQube Scanner:
using a JVM option (from )
However, this did not rectify the situation (same error message).
I also explored adjusting the path in the calling source code:
ProcessBuilder#environment()
(from )While this could be a solution, I refrained from attempting it as I prefer not to modify the SonarQube Scanner source code for maintenance reasons.
(from )ProcessStarter#setGlobalSearchPath
Similarly, I chose not to pursue this option to avoid altering the SonarQube Scanner source code (for maintenance purposes).