Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Installing Node.js v10 doesn't seem to work, installing v9 instead

Trey Gourley February 10, 2021

We are using SonarScanner to scan our .NET Core applications during build.  This tool has upgraded its required Node.js version to v10 instead of v9.  

ERROR: Error during SonarScanner execution
ERROR:
The version of node.js (9) you have used to run this analysis is deprecated and we stopped accepting it. Please update to at least node.js 10.
Temporarily you can set the property 'sonar.scanner.force-deprecated-node-version-grace-period' to 'true' to continue using node.js 9
This will only work until Mon Feb 15 08:00:00 UTC 2021, afterwards all scans will fail.
You can find more information here: https://sonarcloud.io/documentation/upcoming/
ERROR:
The SonarScanner did not complete successfully
16:36:18.584 Post-processing failed. Exit code: 1

Here are the commands that run in the pipeline before sonarscanner runs.

apt-get update
apt-get install --yes nodejs
node -v

In the install, here are the final output lines...

Setting up libbrotli1:amd64 (1.0.7-2+deb10u1) ...
Setting up libc-ares2:amd64 (1.14.0-1) ...
Setting up libuv1:amd64 (1.24.1-1) ...
Setting up libnode64:amd64 (10.23.1~dfsg-1~deb10u1) ...
Setting up nodejs-doc (10.23.1~dfsg-1~deb10u1) ...
Setting up nodejs (10.23.1~dfsg-1~deb10u1) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for libc-bin (2.28-10) ...

 So I would imagine this means that v10.23.1 should install.  But when the version output command is run...

node -v
v9.4.0

Is there something I am missing here that v10.23.1 doesn't get installed?

I will add that I am not a Node.js expert, just using it because SonarScanner needs it.

1 answer

0 votes
ktomk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 10, 2021

First, just in case its an option to put the scan into a pipeline step of it's own: SonarSource also has Docker Images for the Scanner which can be used in a Pipeline step: sonarsource/sonar-scanner-cli - I had this working in the one or other bitbucket pipeline stable.

Having a pipeline step of it's own for the scan task may require you create artifacts in the previous steps so that the scanner can take them in (e.g. code coverage data etc.).

For the problem with the node version:

If you look at this message:

`update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode`

the alternative is set for the `js` utility, this is why the `node` utility is not affected.

that is the explanation only thought. I don't have a debian system at hand right now to quickly pull the command line to set this up.

a quick and dirty variant might be:

rm -f /usr/bin/node ; ln -sfT /usr/bin/nodejs /usr/bin/node

remove /usr/bin/node (in case it exists) ; symlink nodejs to node.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events