SonarScanner CLI for nodejs failing since 10.5 upgrade

Hi,
since updating SonarQube Server to 10.5 we encounter a Problem with one project which fails the scanning. The project is using sonar-scanner CLI. The project is a mix of JAVA + JS code.

Relevant Logs:

2024-05-07 14:31:34 D:\>sonar-scanner -Dsonar.projectKey=REDACTED -Dsonar.sources="REDACTED" -Dsonar.java.binaries="REDACTED" -Dsonar.java.libraries="REDACTED" -Dsonar.exclusions="REDACTED" -Dsonar.sourceEncoding=UTF-8 -Dsonar.host.url=REDACTED -Dsonar.login=REDACTED -Dsonar.c.file.suffixes=- -Dsonar.cpp.file.suffixes=- -Dsonar.objc.file.suffixes=- 
2024-05-07 14:31:34 INFO: Scanner configuration file: D:\sonar-scanner-5.0.1.3006-windows\bin\..\conf\sonar-scanner.properties
2024-05-07 14:31:34 INFO: Project root configuration file: NONE
2024-05-07 14:31:34 INFO: SonarScanner 5.0.1.3006
2024-05-07 14:31:34 INFO: Java 17.0.5 Oracle Corporation (64-bit)
2024-05-07 14:31:34 INFO: Windows 10 10.0 amd64
2024-05-07 14:31:35 INFO: Analyzing on SonarQube server 10.5.1.90531
[...]
2024-05-07 14:47:33 INFO: Sensor IaC AzureResourceManager Sensor [iac] (done) | time=156ms
2024-05-07 14:47:33 INFO: Sensor JavaScript/TypeScript analysis [javascript]
2024-05-07 14:47:55 INFO: Detected os: Windows 10 arch: amd64 alpine: false. Platform: WIN_X64
2024-05-07 14:47:55 INFO: Using embedded Node.js runtime
2024-05-07 14:47:55 INFO: Using Node.js executable: 'C:\Users\REDACTED\.sonar\js\node-runtime\node.exe'.
2024-05-07 14:48:01 INFO: Memory configuration: OS (15998 MB), Node.js (4144 MB).
2024-05-07 14:48:06 ERROR: Error: EPERM: operation not permitted, scandir 'D:/System Volume Information'
2024-05-07 14:48:06 ERROR:     at Object.readdirSync (node:fs:1513:3)
2024-05-07 14:48:06 ERROR:     at searchFiles (D:\.scannerwork\.sonartmp\bridge-bundle\package\lib\shared\src\helpers\find-files.js:74:36)
2024-05-07 14:48:06 ERROR:     at loadPackageJsons (D:\.scannerwork\.sonartmp\bridge-bundle\package\lib\jsts\src\project-metadata\package-json\index.js:42:55)
2024-05-07 14:48:06 ERROR:     at MessagePort.<anonymous> (D:\.scannerwork\.sonartmp\bridge-bundle\package\lib\bridge\src\worker.js:125:25)
2024-05-07 14:48:06 ERROR:     at [nodejs.internal.kHybridDispatch] (node:internal/event_target:807:20)
2024-05-07 14:48:06 ERROR:     at exports.emitMessage (node:internal/per_context/messageport:23:28)
2024-05-07 14:48:06 ERROR: Failure during analysis
2024-05-07 14:48:06 java.lang.IllegalStateException: Failed to initialize linter
2024-05-07 14:48:06 	at org.sonar.plugins.javascript.bridge.BridgeServerImpl.initLinter(BridgeServerImpl.java:352)
2024-05-07 14:48:06 	at org.sonar.plugins.javascript.bridge.BridgeServerImpl.initLinter(BridgeServerImpl.java:318)
2024-05-07 14:48:06 	at org.sonar.plugins.javascript.bridge.JsTsSensor.analyzeFiles(JsTsSensor.java:94)
2024-05-07 14:48:06 	at org.sonar.plugins.javascript.bridge.AbstractBridgeSensor.execute(AbstractBridgeSensor.java:74)
2024-05-07 14:48:06 	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
2024-05-07 14:48:06 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
2024-05-07 14:48:06 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:61)
2024-05-07 14:48:06 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:79)
2024-05-07 14:48:06 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:61)
2024-05-07 14:48:06 	at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
2024-05-07 14:48:06 	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
2024-05-07 14:48:06 	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
2024-05-07 14:48:06 	at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:204)
2024-05-07 14:48:06 	at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:200)
2024-05-07 14:48:06 	at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:173)
2024-05-07 14:48:06 	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
2024-05-07 14:48:06 	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
2024-05-07 14:48:06 	at org.sonar.scanner.bootstrap.SpringScannerContainer.doAfterStart(SpringScannerContainer.java:351)
2024-05-07 14:48:06 	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
2024-05-07 14:48:06 	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
2024-05-07 14:48:06 	at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:138)
2024-05-07 14:48:06 	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
2024-05-07 14:48:06 	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
2024-05-07 14:48:06 	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:71)
2024-05-07 14:48:06 	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:65)
2024-05-07 14:48:06 	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
2024-05-07 14:48:06 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2024-05-07 14:48:06 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
2024-05-07 14:48:06 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2024-05-07 14:48:06 	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
2024-05-07 14:48:06 	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
2024-05-07 14:48:06 	at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
2024-05-07 14:48:06 	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
2024-05-07 14:48:06 	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
2024-05-07 14:48:06 	at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
2024-05-07 14:48:06 	at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
2024-05-07 14:48:06 	at org.sonarsource.scanner.cli.Main.main(Main.java:62)
2024-05-07 14:48:06 
2024-05-07 14:48:06 INFO: Hit the cache for 0 out of 0
2024-05-07 14:48:06 INFO: Miss the cache for 0 out of 0
2024-05-07 14:48:06 INFO: Time spent writing ucfgs 0ms
2024-05-07 14:48:14 INFO: ------------------------------------------------------------------------
2024-05-07 14:48:14 INFO: EXECUTION FAILURE
2024-05-07 14:48:14 INFO: ------------------------------------------------------------------------
2024-05-07 14:48:14 INFO: Total time: 16:39.979s
2024-05-07 14:48:14 INFO: Final Memory: 531M/1788M
2024-05-07 14:48:14 INFO: ------------------------------------------------------------------------
2024-05-07 14:48:14 ERROR: Error during SonarScanner execution
2024-05-07 14:48:14 java.lang.IllegalStateException: Analysis of JS/TS files failed
2024-05-07 14:48:14 	at org.sonar.plugins.javascript.bridge.AbstractBridgeSensor.execute(AbstractBridgeSensor.java:99)
2024-05-07 14:48:14 	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
2024-05-07 14:48:14 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
2024-05-07 14:48:14 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:61)
2024-05-07 14:48:14 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:79)
2024-05-07 14:48:14 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:61)
2024-05-07 14:48:14 	at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
2024-05-07 14:48:14 	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
2024-05-07 14:48:14 	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
2024-05-07 14:48:14 	at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:204)
2024-05-07 14:48:14 	at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:200)
2024-05-07 14:48:14 	at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:173)
2024-05-07 14:48:14 	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
2024-05-07 14:48:14 	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
2024-05-07 14:48:14 	at org.sonar.scanner.bootstrap.SpringScannerContainer.doAfterStart(SpringScannerContainer.java:351)
2024-05-07 14:48:14 	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
2024-05-07 14:48:14 	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
2024-05-07 14:48:14 	at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:138)
2024-05-07 14:48:14 	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
2024-05-07 14:48:14 	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
2024-05-07 14:48:14 	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:71)
2024-05-07 14:48:14 	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:65)
2024-05-07 14:48:14 	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
2024-05-07 14:48:14 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2024-05-07 14:48:14 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
2024-05-07 14:48:14 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2024-05-07 14:48:14 	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
2024-05-07 14:48:14 	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
2024-05-07 14:48:14 	at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
2024-05-07 14:48:14 	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
2024-05-07 14:48:14 	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
2024-05-07 14:48:14 	at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
2024-05-07 14:48:14 	at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
2024-05-07 14:48:14 	at org.sonarsource.scanner.cli.Main.main(Main.java:62)
2024-05-07 14:48:14 Caused by: java.lang.IllegalStateException: Failed to initialize linter
2024-05-07 14:48:14 	at org.sonar.plugins.javascript.bridge.BridgeServerImpl.initLinter(BridgeServerImpl.java:352)
2024-05-07 14:48:14 	at org.sonar.plugins.javascript.bridge.BridgeServerImpl.initLinter(BridgeServerImpl.java:318)
2024-05-07 14:48:14 	at org.sonar.plugins.javascript.bridge.JsTsSensor.analyzeFiles(JsTsSensor.java:94)
2024-05-07 14:48:14 	at org.sonar.plugins.javascript.bridge.AbstractBridgeSensor.execute(AbstractBridgeSensor.java:74)
2024-05-07 14:48:14 	... 33 more

The NodeJS version of the node.exe referenced in the log is v20.9.0.
I don’t know what could cause this, it happened since the update of the SQ Server.
Other projects work fine - however, this project is anyway special as its on a legacy build environment and not like our others.
Any ideas?

Hello Ralf,
Looking at the errors you are encountering, it seems you might not have set up the root project directory correctly, and the scanner is analyzing your entire D:\ directory. To fix this:
a) run the scanner from the root directory of your project
b) set the proper values in the sonar.properties file - more details here

I hope this helps!

Thanks for the hint. indeed the scanner was run from the root it seems, but source directories where limited by parameters. CDing into the project root before running the scanner fixed it.
With 10.4 this worked somehow, with 10.5 no longer :slight_smile:

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