Incorrect Node.js version reference in Typescript analysis documentation?


to be mentioned at the beginning: I am not sure, if the selected category is the correct one for this topic.

I recently updated our self-hosted SonarQube instance to the latest 8.7.0. Some of our projects use TypeScript so the scanner analyses .ts files. This worked well with the previously used SonarQube version 8.4.2.
After upgrading, I recently got connection timeouts from a node server that wants to get started. After searching in the community I found a quite similar but not completely identical bug report and that it might be an incompatible node.js version used in our project.

Referring to the official documentation for analysing JavaScript/Typescript files Node.js >= 10 is supported. We use Node.js 11.15.0 (for this legacy branch) so I thought we are good to go. Unfortunately I got the following error:

ERROR: /workspace/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/queue-microtask/index.js:5
ERROR:   ? queueMicrotask.bind(globalThis)
ERROR:                         ^
ERROR: ReferenceError: globalThis is not defined
ERROR:     at Object.<anonymous> (/workspace/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/queue-microtask/index.js:5:25)
ERROR:     at Module._compile (internal/modules/cjs/loader.js:816:30)
ERROR:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
ERROR:     at Module.load (internal/modules/cjs/loader.js:685:32)
ERROR:     at Function.Module._load (internal/modules/cjs/loader.js:620:12)
ERROR:     at Module.require (internal/modules/cjs/loader.js:723:19)
ERROR:     at require (internal/modules/cjs/helpers.js:14:16)
ERROR:     at Object.<anonymous> (/workspace/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/run-parallel/index.js:4:24)
ERROR:     at Module._compile (internal/modules/cjs/loader.js:816:30)
ERROR:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)


ERROR: Failed to start server (60s timeout)
org.sonarsource.nodejs.NodeCommandException: Failed to start server (60s timeout)
	at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.startServer(
	at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.startServerLazily(
	at org.sonar.plugins.javascript.eslint.AbstractEslintSensor.startBridge(
	at org.sonar.plugins.javascript.eslint.AbstractEslintSensor.execute(
	at org.sonar.plugins.javascript.eslint.JavaScriptEslintBasedSensor.execute(
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(
	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(
	at org.sonar.core.platform.ComponentContainer.startComponents(
	at org.sonar.core.platform.ComponentContainer.execute(
	at org.sonar.scanner.scan.ProjectScanContainer.scan(
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(
	at org.sonar.core.platform.ComponentContainer.startComponents(
	at org.sonar.core.platform.ComponentContainer.execute(
	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(
	at org.sonar.core.platform.ComponentContainer.startComponents(
	at org.sonar.core.platform.ComponentContainer.execute(
	at org.sonar.batch.bootstrapper.Batch.doExecute(
	at org.sonar.batch.bootstrapper.Batch.execute(
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.base/java.lang.reflect.Method.invoke(
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(
	at org.sonarsource.scanner.cli.Main.execute(
	at org.sonarsource.scanner.cli.Main.execute(
	at org.sonarsource.scanner.cli.Main.main(

which didn’t stop the the scanner from further activity and finally sending incorrect data to SonarQube. :confused:

After some research, this error seems to be related to a package issue of queue-microtask pointing out that Node.js 11 is not a supported version.

A bit later I found the scanner property sonar.nodejs.executable to tell the scanner it has to use a specific Node.js binary. Pointing to a Node.js >= 12, the scanner now successfully scans Typescript files so my problem is solved.

This makes me wonder if the documentation might not be correct regarding the necessary Node.js version for the scanner?

Thanks in advance for your response.

Kind regards,

Hey there.

NodeJS 11 is, unfortunately, specifically a troublemaker (and, for what it’s worth, no longer a supported version). See SonarSource/SonarJS #2496. Looks like you’ve already found this in your research.

So we recently released a bugfix of our Javascript/Typescript analyzer that will make its way into our next SonarQube release – a warning will get logged whenever you’re running on an unsupported version of Node.JS (as of today supported versions are v10, v12, v14 and v15).

The docs will also get updated to reflect this (see the pull request).

Point taken. But everyone and their sister has a different opinion on whether to fail early, or offer as much of the results possible and log a warning.

Hope this helps!

Hi Colin,

thanks a lot for your detailed response. Happy to hear that this is not new to you and that a fix is on its way.

Good point. It might not be good to let the scanner fail for this specific failure, especially when it is just a minor part of a massive scan and wouldn’t affect the overall result.

Solved. :+1:


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