Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: .sonartmp/eslint-bridge-bundle/package/node_modules/@eslint/eslintrc/universal.js

  • Jenkins plugin sonar-scanner-cli-4.6.2.2472
ERROR: internal/modules/cjs/loader.js:1174
ERROR:   throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
ERROR:   ^
ERROR:
ERROR: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: .sonartmp/eslint-bridge-bundle/package/node_modules/@eslint/eslintrc/universal.js
ERROR: require() of ES modules is not supported.
ERROR: require() of .sonartmp/eslint-bridge-bundle/package/node_modules/@eslint/eslintrc/universal.js from .sonartmp/eslint-bridge-bundle/package/node_modules/eslint/lib/linter/linter.js is an ES module file as it is a .js file whose nearest parent package.json contains “type”: “module” which defines all .js files in that package scope as ES modules.
ERROR: Instead rename universal.js to end in .cjs, change the requiring code to use import(), or remove “type”: “module” from.sonartmp/eslint-bridge-bundle/package/node_modules/@eslint/eslintrc/package.json.
ERROR:
ERROR:  at Object.Module._extensions..js (internal/modules/cjs/loader.js:1174:13)
ERROR:  at Module.load (internal/modules/cjs/loader.js:1002:32)
ERROR:  at Function.Module._load (internal/modules/cjs/loader.js:901:14)
ERROR:  at Module.require (internal/modules/cjs/loader.js:1044:19)
ERROR:  at require (internal/modules/cjs/helpers.js:77:18)
ERROR:  at Object.<anonymous> (.sonartmp/eslint-bridge-bundle/package/node_modules/eslint/lib/linter/linter.js:27:9)
ERROR:  at Module._compile (internal/modules/cjs/loader.js:1158:30)
ERROR:  at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
ERROR:  at Module.load (internal/modules/cjs/loader.js:1002:32)
ERROR:  at Function.Module._load (internal/modules/cjs/loader.js:901:14) {
ERROR: code: ‘ERR_REQUIRE_ESM’
ERROR: }
ERROR: Failed to start server (300s timeout)
org.sonarsource.nodejs.NodeCommandException: Failed to start server (300s timeout)
 	at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.startServer(EslintBridgeServerImpl.java:135)
	at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.startServerLazily(EslintBridgeServerImpl.java:212)
	at org.sonar.plugins.javascript.eslint.AbstractEslintSensor.execute(AbstractEslintSensor.java:66)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:62)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:75)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:48)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:66)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:48)
	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:64)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:438)
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:434)
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:392)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:128)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
 	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:58)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:52)
	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(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	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)
ERROR: eslint-bridge Node.js process is unresponsive. This is most likely caused by process running out of memory. Consider setting sonar.javascript.node.maxspace to higher value (e.g. 4096).
  • Started reproduce since 17.02.2022
  • sonar.javascript.node.maxspace set to 4Gb or 8Gb does not help

Hi,

Welcome to the community!

Could you also include the lines of the analysis log leading up to this error, please?

 
Thx,
Ann

Hi Ann,

/home/****/agent/tools/hudson.plugins.sonar.SonarRunnerInstallation/SonarCloud-Scanner/bin/sonar-scanner -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=**** -Dsonar.projectKey=****_ng-ui_sp -Dsonar.projectName=ng-ui-sp -Dsonar.projectVersion=2.13.125-pr-3175.19 -Dsonar.organization=****1 -Dsonar.sources=libs/sp -Dsonar.test.inclusions=**/*.spec.ts -Dsonar.exclusions=tmp/**,libs/sp/assets/** -Dsonar.javascript.lcov.reportPaths=coverage/libs/sp/lcov.info -Dsonar.working.directory=scanner/sp -Dsonar.javascript.node.maxspace=8192 -Dsonar.pullrequest.base=master -Dsonar.pullrequest.branch=MP-20075-1 -Dsonar.pullrequest.key=3175

Thanks, Oleksii

Hi Oleksii,

That’s not your analysis log; that’s your analysis command line. And while helpful, it’s not what I’m asking for. I’m asking for the log output from that command.

 
Ann

Hi Ann,
I sent all sonarcloud output logs in the first message.
I found woraround - set property sonar.scanner.dumpToFile and error logs doesn’t appear.
Could you please send sonarcloud properties that need to get log output on level what you need?
Thanks, Oleksii

Hi Oleksii,

I’m asking for the full analysis log: the logging from (ideally including) the analysis command.

 
Ann

A post was split to a new topic: Eslint-bridge is unresponsive - connection refused