I try to analyze a TypeScript project in Jenkins with SonarQube Scanner plug-in on a Mac OS slave.
Tools:
- 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)
Problem:
SonarTS plug-in tries to start Node.js, but Node.js is not in the PATH
variable, see 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)
Research:
I tried to configure the path on Mac with:
environment.plist
(from https://stackoverflow.com/a/15313578/5277820)but it doesn't work, because it is not supported anymore.
/etc/launchd.conf
(from https://stackoverflow.com/a/15257454/5277820)but it doesn't work, because it is not supported anymore.
/etc/paths.d/
(from https://apple.stackexchange.com/a/106549)but it doesn't work (same error message).
I tried to use the already added paths (/usr/bin
, /bin
, /usr/sbin
, /sbin
) with:
symbolic link
but it doesn't work, because the paths are write-protected (even for administrator).
I tried to pass the path to the SonarQube Scanner:
JVM option (from https://stackoverflow.com/a/21094766/5277820)
but it doesn't work (same error message).
I also read about changing path in the calling source:
ProcessBuilder#environment()
(from https://stackoverflow.com/a/5155791/5277820)but I didn't try it, because I don't want to patch the SonarQube Scanner source (for maintenance reasons).
ProcessStarter#setGlobalSearchPath
(from https://stackoverflow.com/a/15206961/5277820)but I didn't try it, because I don't want to patch the SonarQube Scanner source (for maintenance reasons).