Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runSonarQube.sh fail when starts to scan javascript files #235

Open
paraddise opened this issue Nov 13, 2024 · 0 comments
Open

runSonarQube.sh fail when starts to scan javascript files #235

paraddise opened this issue Nov 13, 2024 · 0 comments

Comments

@paraddise
Copy link

When start scanning javascript files

It says that NodeJs binary could not be found.

I tried to set sonar.nodejs.executable=/usr/bin/node and increate nodejs max old space size, but it didn't help, but logs changed.

11:12:15.295 INFO  Sensor JavaScript/TypeScript analysis [javascript]
11:12:15.302 DEBUG Deploying the bridge server into /tmp/.scannerwork/.sonartmp/bridge-bundle
11:12:17.424 INFO  'sonar.nodejs.executable' is set. Skipping embedded Node.js runtime deployment.
11:12:17.424 DEBUG Starting server
11:12:17.426 DEBUG Creating Node.js process to start the bridge server on port 56365
11:12:17.427 INFO  Configured Node.js --max-old-space-size=4096.
11:12:17.428 INFO  Using Node.js executable /usr/bin/node from property sonar.nodejs.executable.
11:12:17.428 DEBUG Checking Node.js version
11:12:17.428 DEBUG Launching command /usr/bin/node -v
11:12:17.440 DEBUG Using Node.js v18.20.2.
11:12:17.440 DEBUG Launching command /usr/bin/node --max-old-space-size=4096 /tmp/.scannerwork/.sonartmp/bridge-bundle/package/bin/server 56365 127.0.0.1 /tmp/.scannerwork true false false
11:12:20.773 INFO  Memory configuration: OS (11959 MB), Node.js (4144 MB).
11:12:20.774 DEBUG Starting the bridge server
11:12:20.793 DEBUG The bridge server is listening on port 56365
11:12:20.848 DEBUG The worker thread is running
11:12:35.788 DEBUG Shutting down the worker
11:12:35.792 INFO  Rule | Time (ms) | Relative
11:12:35.792 INFO  :----|----------:|--------:
11:12:35.812 DEBUG The worker thread exited with code 0
11:12:35.814 DEBUG The bridge server shut down
11:12:35.815 INFO  Rule | Time (ms) | Relative
11:12:35.815 INFO  :----|----------:|--------:
11:17:17.457 ERROR Failed to start the bridge server (300s timeout)
org.sonar.plugins.javascript.nodejs.NodeCommandException: Failed to start the bridge server (300s timeout)
	at org.sonar.plugins.javascript.bridge.BridgeServerImpl.startServer(BridgeServerImpl.java:209)
	at org.sonar.plugins.javascript.bridge.BridgeServerImpl.startServerLazily(BridgeServerImpl.java:312)
	at org.sonar.plugins.javascript.analysis.AbstractBridgeSensor.execute(AbstractBridgeSensor.java:76)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:61)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:79)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:61)
	at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:204)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:200)
	at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:173)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
	at org.sonar.scanner.bootstrap.SpringScannerContainer.doAfterStart(SpringScannerContainer.java:351)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
	at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:144)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
	at org.sonar.scanner.bootstrap.ScannerMain.runScannerEngine(ScannerMain.java:149)
	at org.sonar.scanner.bootstrap.ScannerMain.run(ScannerMain.java:66)
	at org.sonar.scanner.bootstrap.ScannerMain.main(ScannerMain.java:52)

11:17:17.457 INFO  Hit the cache for 0 out of 0
11:17:17.459 INFO  Miss the cache for 0 out of 0
11:17:18.331 ERROR Error during SonarScanner Engine execution
java.lang.IllegalStateException: Error while running Node.js. A supported version of Node.js is required for running the analysis of JS/TS files. Please make sure a supported version of Node.js is available in the PATH or an executable path is provided via 'sonar.nodejs.executable' property. Alternatively, you can exclude JS/TS files from your analysis using the 'sonar.exclusions' configuration property. See the docs for configuring the analysis environment: https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/languages/javascript-typescript-css/
	at org.sonar.plugins.javascript.analysis.AbstractBridgeSensor.execute(AbstractBridgeSensor.java:89)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:61)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:79)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:61)
	at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:204)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:200)
	at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:173)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
	at org.sonar.scanner.bootstrap.SpringScannerContainer.doAfterStart(SpringScannerContainer.java:351)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
	at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:144)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
	at org.sonar.scanner.bootstrap.ScannerMain.runScannerEngine(ScannerMain.java:149)
	at org.sonar.scanner.bootstrap.ScannerMain.run(ScannerMain.java:66)
	at org.sonar.scanner.bootstrap.ScannerMain.main(ScannerMain.java:52)
Caused by: org.sonar.plugins.javascript.nodejs.NodeCommandException: Failed to start the bridge server (300s timeout)
	at org.sonar.plugins.javascript.bridge.BridgeServerImpl.startServer(BridgeServerImpl.java:209)
	at org.sonar.plugins.javascript.bridge.BridgeServerImpl.startServerLazily(BridgeServerImpl.java:312)
	at org.sonar.plugins.javascript.analysis.AbstractBridgeSensor.execute(AbstractBridgeSensor.java:76)
	... 22 common frames omitted

11:17:18.334 DEBUG Cleanup org.eclipse.jgit.util.FS$FileStoreAttributes$$Lambda$345/0x00007fe6dc2a6f00@7f9e1534 during JVM shutdown
11:17:18.698 DEBUG Java command exited with code 1
11:17:18.698 INFO  EXECUTION FAILURE
11:17:18.700 INFO  Total time: 7:36.047s
Waiting for SonarQube CE to finish task

My version of running sonarqube-cli

docker run --env SONAR_SCANNER_OPTS=-Xmx4g --net=host --rm -v ~/.m2:/root/.m2 -v "$(pwd)":"$(pwd)" -w "$(pwd)" sonarsource/sonar-scanner-cli \
  -Dsonar.java.binaries="target" -Dsonar.projectKey="$sonar_project" \
  -Dsonar.host.url="$sonar_host" \
  -Dsonar.login="$sonar_token" \
  -Dsonar.sources="src" \
  -Dsonar.exclusions=".horusec/**,owasp-benchmark/**,results/**,scorecard/**,scripts/**,tools/**,VMs/**" \
  -Dsonar.nodejs.executable="/usr/bin/node" \
  -Dsonar.javascript.node.maxspace="4096" \
  -Dsonar.verbose=true

If this bug related to SonarQube not runSonarQube.sh script tell me please, this is my first interaction with sonarqube.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant