It seems that sonar.nodejs.executable interprets strings "\n" or "\t" or so as a special character OR uses the delimiter "\" as escape code

Error I got

ERROR: Provided Node.js executable file does not exist. Property 'sonar.nodejs.executable' was to 'C:Users      adashi.oyawork  estdir
ode-v14.15.1-win-x64
ode.exe'

I expected '...testdir\node-v14.15.1-win-x64\node.exe' but sonar scanner interpreted

'...  estdir
ode-v14.15.1-win-x64
ode.exe'

Versions

  • SonarQube: 8.6
  • SonarScanner: 4.5(sonar-scanner-4.5.0.2216-windows)
  • node.js: node-v14.15.1-win-x64

Steps to reproduce

(1) I prepared sonar-scanner, node, repository.

PS> pwd
Path
----
C:\Users\tadashi.oya\work\testdir

PS> ls -name
node-v14.15.1-win-x64
repository
sonar-scanner-4.5.0.2216-windows

(2) I wrote conf\sonar-scanner.properties.

sonar.projectKey=sample_repository
sonar.host.url=http://192.168.56.11:9000
sonar.nodejs.executable=C:\Users\tadashi.oya\work\testdir\node-v14.15.1-win-x64\node.exe
# These below have the same result.
# sonar.nodejs.executable='C:\Users\tadashi.oya\work\testdir\node-v14.15.1-win-x64\node.exe'
# sonar.nodejs.executable="C:\Users\tadashi.oya\work\testdir\node-v14.15.1-win-x64\node.exe"

(3) I got the following log.

PS C:\Users\tadashi.oya\work\testdir\repository> ..\sonar-scanner-4.5.0.2216-windows\bin\sonar-scanner.bat
INFO: Scanner configuration file: C:\Users\tadashi.oya\work\testdir\sonar-scanner-4.5.0.2216-windows\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 4.5.0.2216
INFO: Java 11.0.3 AdoptOpenJDK (64-bit)
INFO: Windows 10 10.0 amd64
INFO: User cache: C:\Users\tadashi.oya\.sonar\cache
INFO: Scanner configuration file: C:\Users\tadashi.oya\work\testdir\sonar-scanner-4.5.0.2216-windows\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: Analyzing on SonarQube server 8.6.0
INFO: Default locale: "ja_JP", source code encoding: "windows-31j" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=90ms
INFO: Server id: 243B8A4D-AXUrkziEZXX9wbHhf0PT
INFO: User cache: C:\Users\tadashi.oya\.sonar\cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=39ms
INFO: Load/download plugins (done) | time=97ms
INFO: Process project properties
INFO: Process project properties (done) | time=1ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=2ms
INFO: Project key: sample_repository
INFO: Base dir: C:\Users\tadashi.oya\work\testdir\repository
INFO: Working dir: C:\Users\tadashi.oya\work\testdir\repository\.scannerwork
INFO: Load project settings for component key: 'sample_repository'
INFO: Load project settings for component key: 'sample_repository' (done) | time=31ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=54ms
INFO: Load active rules
INFO: Load active rules (done) | time=991ms
INFO: Indexing files...
INFO: Project configuration:
INFO: Load project repositories
INFO: Load project repositories (done) | time=26ms
INFO: 205 files indexed
INFO: 0 files ignored because of scm ignore settings
INFO: Quality profile for css: Sonar way
INFO: Quality profile for js: Sonar way
INFO: Quality profile for php: Sonar way
INFO: ------------- Run sensors on module sample_repository
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=44ms
INFO: Sensor CSS Metrics [cssfamily]
INFO: Sensor CSS Metrics [cssfamily] (done) | time=187ms
INFO: Sensor CSS Rules [cssfamily]
ERROR: Provided Node.js executable file does not exist. Property 'sonar.nodejs.executable' was to 'C:Users      adashi.oyawork  estdir
ode-v14.15.1-win-x64
ode.exe'
ERROR: CSS rules were not executed. Provided Node.js executable file does not exist.
org.sonarsource.nodejs.NodeCommandException: Provided Node.js executable file does not exist.
        at org.sonarsource.nodejs.NodeCommandBuilderImpl.retrieveNodeExecutableFromConfig(NodeCommandBuilderImpl.java:212)
        at org.sonarsource.nodejs.NodeCommandBuilderImpl.build(NodeCommandBuilderImpl.java:133)
        at org.sonar.css.plugin.server.CssAnalyzerBridgeServer.initNodeCommand(CssAnalyzerBridgeServer.java:153)
        at org.sonar.css.plugin.server.CssAnalyzerBridgeServer.startServer(CssAnalyzerBridgeServer.java:104)
        at org.sonar.css.plugin.server.CssAnalyzerBridgeServer.startServerLazily(CssAnalyzerBridgeServer.java:173)
        at org.sonar.css.plugin.CssRuleSensor.execute(CssRuleSensor.java:99)
        at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
        at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
        at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:393)
        at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:389)
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
        at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:144)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
        at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
        at com.sun.proxy.$Proxy0.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
        at org.sonarsource.scanner.cli.Main.main(Main.java:61)

INFO: Sensor CSS Rules [cssfamily] (done) | time=4327ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=5ms
INFO: Sensor JavaScript analysis [javascript]
ERROR: Provided Node.js executable file does not exist. Property 'sonar.nodejs.executable' was to 'C:Users      adashi.oyawork  estdir
ode-v14.15.1-win-x64
ode.exe'
ERROR: Provided Node.js executable file does not exist.
org.sonarsource.nodejs.NodeCommandException: Provided Node.js executable file does not exist.
        at org.sonarsource.nodejs.NodeCommandBuilderImpl.retrieveNodeExecutableFromConfig(NodeCommandBuilderImpl.java:212)
        at org.sonarsource.nodejs.NodeCommandBuilderImpl.build(NodeCommandBuilderImpl.java:133)
        at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.initNodeCommand(EslintBridgeServerImpl.java:165)
        at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.startServer(EslintBridgeServerImpl.java:114)
        at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.startServerLazily(EslintBridgeServerImpl.java:182)
        at org.sonar.plugins.javascript.eslint.AbstractEslintSensor.startBridge(AbstractEslintSensor.java:145)
        at org.sonar.plugins.javascript.eslint.AbstractEslintSensor.execute(AbstractEslintSensor.java:119)
        at org.sonar.plugins.javascript.eslint.JavaScriptEslintBasedSensor.execute(JavaScriptEslintBasedSensor.java:51)
        at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
        at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
        at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:393)
        at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:389)
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
        at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:144)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
        at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
        at com.sun.proxy.$Proxy0.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
        at org.sonarsource.scanner.cli.Main.main(Main.java:61)

INFO: Sensor JavaScript analysis [javascript] (done) | time=6859ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=1ms
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=2ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=158ms
INFO: Sensor PHP sensor [php]
INFO: Starting PHP symbol indexer
INFO: 117 source files to be analyzed
INFO: 117/117 source files have been analyzed
INFO: Starting PHP rules
INFO: 117 source files to be analyzed
INFO: 117/117 source files have been analyzed
INFO: No PHPUnit test report provided (see 'sonar.php.tests.reportPath' property)
INFO: No PHPUnit coverage reports provided (see 'sonar.php.coverage.reportPaths' property)
INFO: Sensor PHP sensor [php] (done) | time=6298ms
INFO: Sensor Analyzer for "php.ini" files [php]
INFO: Sensor Analyzer for "php.ini" files [php] (done) | time=4ms
INFO: Sensor VB.NET Properties [vbnet]
INFO: Sensor VB.NET Properties [vbnet] (done) | time=1ms
INFO: ------------- Run sensors on project
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=119ms
INFO: CPD Executor 15 files had no CPD blocks
INFO: CPD Executor Calculating CPD for 102 files
INFO: CPD Executor CPD calculation finished (done) | time=204ms
INFO: Analysis report generated in 296ms, dir size=841 KB
INFO: Analysis report compressed in 3616ms, zip size=405 KB
INFO: Analysis report uploaded in 48ms
INFO: ANALYSIS SUCCESSFUL, you can browse http://192.168.56.11:9000/dashboard?id=sample_repository
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://192.168.56.11:9000/api/ce/task?id=AXZgftmd0KTeXs8mUTSA
INFO: Analysis total time: 32.039 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 33.758s
INFO: Final Memory: 7M/34M
INFO: ------------------------------------------------------------------------
PS C:\Users\tadashi.oya\work\testdir\repository>

Has anyone reproduced this issue?

Hi,

Welcome to the community!

It looks like your \t and \n got interpreted as whitespace characters. You’re going to either need to flip your slashes (.../testdir/node-v14.15.1-win-x64/node.exe) or escape them (...\\testdir\\node-v14.15.1-win-x64\\node.exe)

 
HTH,
Ann

1 Like

Hi,
Thank you for your response.

“\\testdir\\node-v14.15.1-win-x64\\node.exe” works fine. It says

INFO: Using Node.js executable C:\Users\tadashi.oya\work\testdir\node-v14.15.1-win-x64\node.exe from property sonar.nodejs.executable.

“/testdir/node-v14.15.1-win-x64/node.exe” gets following error

ERROR: Provided Node.js executable file does not exist. Property 'sonar.nodejs.executable' was to '"C:/Users/tadashi.oya/work/testdir/node-v14.15.1-win-x64/node.exe"'

I want sonar.nodejs.executable to interpret ‘\node.exe’ as ‘\node.exe’ literally.
I would like to wait for the day when this issue gets a fix someday.

Thank you.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.