INFO: Sensor SonarCSS Rules [cssfamily]
ERROR: (node:47) ExperimentalWarning: The ESM module loader is experimental.
ERROR: internal/modules/run_main.js:54
ERROR: internalBinding('errors').triggerUncaughtException(
ERROR: ^
ERROR:
ERROR: TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for /builds/gaspacchio/back-to-the-future/.scannerwork/css-bundle/bin/server
ERROR: at Loader.defaultGetFormat [as _getFormat] (internal/modules/esm/get_format.js:65:15)
ERROR: at Loader.getFormat (internal/modules/esm/loader.js:113:42)
ERROR: at Loader.getModuleJob (internal/modules/esm/loader.js:244:31)
ERROR: at processTicksAndRejections (internal/process/task_queues.js:97:5)
ERROR: at async Loader.import (internal/modules/esm/loader.js:178:17) {
ERROR: code: 'ERR_UNKNOWN_FILE_EXTENSION'
ERROR: }
ERROR: CSS rules were not executed. Failed to start server (60s timeout)
org.sonarsource.nodejs.NodeCommandException: Failed to start server (60s timeout)
at org.sonar.css.plugin.server.CssAnalyzerBridgeServer.startServer(CssAnalyzerBridgeServer.java:110)
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:45)
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:68)
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:126)
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(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 SonarCSS Rules [cssfamily] (done) | time=61472ms
(...)
WARN: Failed to close stylelint-bridge server
java.net.ConnectException: Failed to connect to /127.0.0.1:42541
at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:265)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:183)
at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.java:224)
at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.java:108)
at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.java:88)
at okhttp3.internal.connection.Transmitter.newExchange(Transmitter.java:169)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:41)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:221)
at okhttp3.RealCall.execute(RealCall.java:81)
at org.sonar.css.plugin.server.CssAnalyzerBridgeServer.callClose(CssAnalyzerBridgeServer.java:271)
at org.sonar.css.plugin.server.CssAnalyzerBridgeServer.clean(CssAnalyzerBridgeServer.java:260)
at org.sonar.css.plugin.server.CssAnalyzerBridgeServer.stop(CssAnalyzerBridgeServer.java:255)
at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.stop(StartableCloseableSafeLifecyleStrategy.java:38)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.stop(AbstractInjectionFactory.java:88)
at org.picocontainer.behaviors.AbstractBehavior.stop(AbstractBehavior.java:179)
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.stop(Stored.java:141)
at org.picocontainer.behaviors.Stored.stop(Stored.java:118)
at org.picocontainer.DefaultPicoContainer.stopAdapters(DefaultPicoContainer.java:1048)
at org.picocontainer.DefaultPicoContainer.stop(DefaultPicoContainer.java:803)
at org.sonar.core.platform.ComponentContainer.stopComponents(ComponentContainer.java:152)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:111)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:126)
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(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)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.base/java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
at java.base/java.net.Socket.connect(Unknown Source)
at okhttp3.internal.platform.Platform.connectSocket(Platform.java:130)
at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:263)
... 47 common frames omitted
INFO: Analysis total time: 1:40.702 s
Good morning, I am having the same issue, with nodejs v.14.16.0
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=45ms
INFO: Sonargraph Integration: Created 55 predefined and 0 custom metric(s)
INFO: Sensor CSS Metrics [cssfamily]
INFO: Sensor CSS Metrics [cssfamily] (done) | time=161ms
INFO: Sensor CSS Rules [cssfamily]
ERROR: internal/process/esm_loader.js:74
ERROR: internalBinding(‘errors’).triggerUncaughtException(
ERROR: ^
ERROR:
ERROR: TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension “” for /var/lib/jenkins/jobs/sandbox/workspace/.scannerwork/css-bundle/bin/server
ERROR: at Loader.defaultGetFormat [as _getFormat] (internal/modules/esm/get_format.js:71:15)
ERROR: at Loader.getFormat (internal/modules/esm/loader.js:102:42)
ERROR: at Loader.getModuleJob (internal/modules/esm/loader.js:231:31)
ERROR: at async Loader.import (internal/modules/esm/loader.js:165:17)
ERROR: at async Object.loadESM (internal/process/esm_loader.js:68:5) {
ERROR: code: ‘ERR_UNKNOWN_FILE_EXTENSION’
ERROR: }
ERROR: CSS rules were not executed. Failed to start server (60s timeout)
org.sonarsource.nodejs.NodeCommandException: Failed to start server (60s timeout)
at org.sonar.css.plugin.server.CssAnalyzerBridgeServer.startServer(CssAnalyzerBridgeServer.java:113)
at org.sonar.css.plugin.server.CssAnalyzerBridgeServer.startServerLazily(CssAnalyzerBridgeServer.java:177)
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:389)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:385)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:354)
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]
ERROR: internal/process/esm_loader.js:74
ERROR: internalBinding('errors').triggerUncaughtException(
ERROR: ^
ERROR:
ERROR: TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for /github/workspace/.scannerwork/css-bundle/bin/server
ERROR: at Loader.defaultGetFormat [as _getFormat] (internal/modules/esm/get_format.js:71:15)
ERROR: at Loader.getFormat (internal/modules/esm/loader.js:102:42)
ERROR: at Loader.getModuleJob (internal/modules/esm/loader.js:231:31)
ERROR: at async Loader.import (internal/modules/esm/loader.js:165:17)
ERROR: at async Object.loadESM (internal/process/esm_loader.js:68:5) {
ERROR: code: 'ERR_UNKNOWN_FILE_EXTENSION'
ERROR: }
ERROR: CSS rules were not executed. Failed to start server (60s timeout)
org.sonarsource.nodejs.NodeCommandException: Failed to start server (60s timeout)
at org.sonar.css.plugin.server.CssAnalyzerBridgeServer.startServer(CssAnalyzerBridgeServer.java:113)
at org.sonar.css.plugin.server.CssAnalyzerBridgeServer.startServerLazily(CssAnalyzerBridgeServer.java:177)
at org.sonar.css.plugin.CssRuleSensor.execute(CssRuleSensor.java:99)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:45)
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:68)
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:442)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:438)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:396)
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(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=60714ms
I can confirm this issue is a result of using ESModules, ie: setting “type”: “module” in package.json. The CSS Scanner is missing the file extension on an import and needs to be updated.
This is a blocking issue for me as I have a ton of scripts in module format, I am not going to convert it all to CommonJS because of SonarQube.
I was finally able to reproduce this problem. It seems that we accidentally pickup package.json from the analyzed project, and if this project is setting type:module in package.json it will fail to start CSS analysis.
To workaround this issue you can configure the scanner work dir to be located outside of the analyzed project using sonar.working.directory property.
This will be also fixed in the next release of SonarQube 9.2 and soon it will be deployed on SonarCloud (I expect next week).
Sorry, that this took so long to address, we were not able to reproduce the problem on our side until very recently.
Error seems not to be fixed. I get this error using latest sonar scanner cli in docker (full log in zip)
ERROR: node:internal/errors:477
ERROR: ErrorCaptureStackTrace(err);
ERROR: ^
ERROR:
ERROR: TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for /usr/src/.scannerwork/css-bundle/bin/server. Loading extensionless files is not supported inside of "type":"module" package.json contexts. The package.json file /usr/src/package.json caused this "type":"module" context. Try changing /usr/src/.scannerwork/css-bundle/bin/server to have a file extension. Note the "bin" field of package.json can point to a file with an extension, for example {"type":"module","bin":{"server":"./.scannerwork/css-bundle/bin/server.js"}}
ERROR: at new NodeError (node:internal/errors:387:5)
ERROR: at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:76:11)
ERROR: at defaultGetFormat (node:internal/modules/esm/get_format:118:38)
ERROR: at defaultLoad (node:internal/modules/esm/load:81:20)
ERROR: at nextLoad (node:internal/modules/esm/loader:165:28)
ERROR: at ESMLoader.load (node:internal/modules/esm/loader:608:26)
ERROR: at ESMLoader.moduleProvider (node:internal/modules/esm/loader:464:22)
ERROR: at new ModuleJob (node:internal/modules/esm/module_job:63:26)
ERROR: at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:483:17)
ERROR: at ESMLoader.getModuleJob (node:internal/modules/esm/loader:441:34) {
ERROR: code: 'ERR_UNKNOWN_FILE_EXTENSION'
ERROR: }
ERROR: CSS rules were not executed. Failed to start server (60s timeout)
unzip example project using "type": "module" in package.json. sonartest.zip (22.1 KB)
add valid sonar-project,properties
execute docker run --rm -v "$(pwd):/usr/src" sonarsource/sonar-scanner-cli
Workaround is to remove “type” field in package.json
It seems to be the same issue mentioned from saberduck, but just in css-bundle package.