SonarCloud task fails on issues in micromatch\index.js:44

Since tuesday we have been experiencing the following issues in builds running SonarCloud code analysis:

##[error]ERROR: d:\a\1\.sonarqube\out\.sonar\mod19\css-bundle\node_modules\micromatch\index.js:44
ERROR: d:\a\1\.sonarqube\out\.sonar\mod19\css-bundle\node_modules\micromatch\index.js:44
##[error]ERROR:     let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true);
ERROR:                                                    ^^^
ERROR: SyntaxError: Unexpected token ...
ERROR:     at Object.exports.runInThisContext (vm.js:76:16)
ERROR:     at Module._compile (module.js:542:28)
ERROR:     at Object.Module._extensions..js (module.js:579:10)
ERROR:     at Module.load (module.js:487:32)
ERROR:     at tryModuleLoad (module.js:446:12)
ERROR:     at Function.Module._load (module.js:438:3)
ERROR:     at Module.require (module.js:497:17)
ERROR:     at require (internal/module.js:20:19)
ERROR:     at Object.<anonymous> (d:\a\1\.sonarqube\out\.sonar\mod19\css-bundle\node_modules\stylelint\lib\isPathIgnored.js:4:20)
ERROR:     let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true);
ERROR:                                                    ^^^
ERROR: SyntaxError: Unexpected token ...
ERROR:     at Object.exports.runInThisContext (vm.js:76:16)
ERROR:     at Module._compile (module.js:542:28)
ERROR:     at Object.Module._extensions..js (module.js:579:10)
ERROR:     at Module.load (module.js:487:32)
ERROR:     at tryModuleLoad (module.js:446:12)
ERROR:     at Function.Module._load (module.js:438:3)
ERROR:     at Module.require (module.js:497:17)
ERROR:     at require (internal/module.js:20:19)
ERROR:     at Object.<anonymous> (d:\a\1\.sonarqube\out\.sonar\mod19\css-bundle\node_modules\stylelint\lib\isPathIgnored.js:4:20)
##[error]ERROR:     at Module._compile (module.js:570:32)
ERROR:     at Module._compile (module.js:570:32)
##[error]ERROR: Analysis didn't terminate normally, please verify ERROR and WARN logs above. Exit code 1

I could not figure out the cause, and it seems the analysis is performed correctly otherwise (analysis continues after these errors). It is just that the tast fails (and therefor the build). We use Azure DevOps and therefor the SonarCloud tasks (v1.6.3 to be precise).

Anyone any idea what could be the cause?

Hi,

it’s CSS analysis fails due to the syntax not supported by your NodeJS version. In fact we require NodeJS >=6 but looks like this dependency need NodeJS >=8. Probably updating NodeJS you use on this machine to version >=8 will fix the problem.
In the meantime I will check what can we do on our side.

Hi Elena, thanks for your reply. If we run the specified task on a machine that has Node >= 8 installed it still fails but with a more generic error, see a snippet of the logging below:

14:37:46.399 DEBUG: Deploying bundle to D:\a\1\.sonarqube\out\.sonar\mod2
14:37:49.058 DEBUG: Using default Node.js executable: 'node'.
14:37:49.058 DEBUG: Checking Node.js version
14:37:49.073 DEBUG: Launching command [node, -v]
14:37:49.872 DEBUG: Using Node.js v8.10.0.
14:37:49.887 DEBUG: Starting process: node D:\a\1\.sonarqube\out\.sonar\mod2\css-bundle\node_modules\stylelint\bin\stylelint D:\a\1\s\Operator.Building.Commissioning.Hosting\**\*{.css,.less,.scss,.html,.xhtml,.cshtml,.vbhtml,.aspx,.ascx,.rhtml,.erb,.shtm,.shtml,php,php3,php4,php5,phtml,inc,.js,.jsx,.vue,.ts,.tsx} --config D:\a\1\.sonarqube\out\.sonar\mod2\css-bundle\stylelintconfig.json -f json
14:37:49.887 DEBUG: Launching command [node, D:\a\1\.sonarqube\out\.sonar\mod2\css-bundle\node_modules\stylelint\bin\stylelint, D:\a\1\s\Operator.Building.Commissioning.Hosting\**\*{.css,.less,.scss,.html,.xhtml,.cshtml,.vbhtml,.aspx,.ascx,.rhtml,.erb,.shtm,.shtml,php,php3,php4,php5,phtml,inc,.js,.jsx,.vue,.ts,.tsx}, --config, D:\a\1\.sonarqube\out\.sonar\mod2\css-bundle\stylelintconfig.json, -f, json]
##[error]14:37:53.380 ERROR: Analysis didn't terminate normally, please verify ERROR and WARN logs above. Exit code 1
##[debug]Processed: ##vso[task.logissue type=error;]14:37:53.380 ERROR: Analysis didn't terminate normally, please verify ERROR and WARN logs above. Exit code 1
14:37:53.380 ERROR: Analysis didn't terminate normally, please verify ERROR and WARN logs above. Exit code 1

Any assistance would be much appreciated.

Is the log in your last message from a a fresh run today? I’m asking because it has features of version 1.1.0 of the CSS plugin, which should not be the case today. Can you please clarify?

No, I had already tried this a couple of days ago during troubleshooting (which i forgot to mention in the initial message, sorry).

@Vossekop

Could you run with NodeJS v8 now?

Yes it seems to work now.Although an older version of Node is required for another part of the pipeline. That is a problem I can probably work around however.

Thanks for the help!

Hi There, @Lena

I’m seeing a similar problem but not using Node.js in the specific project being analysed;

##[error]ERROR: D:\a\1.sonarqube\out.sonar\mod10\css-bundle\node_modules\micromatch\index.js:44
ERROR: D:\a\1.sonarqube\out.sonar\mod10\css-bundle\node_modules\micromatch\index.js:44
##[error]ERROR: let isMatch = picomatch(String(patterns[i]), { …options, onResult }, true);

Does anyone have any ideas please?

Kind regards

Ben

@benz66 could you start a new thread with a full description of your problem?

Hi @Lena
Of course. Sorry I added to this thread, it was only because I thought it was the same problem.
Kind regards
@benz66