NodeCommandException: Only Node.js vX is supported

Hello,

My bitbucket sonarcloud pipeline on pull request started to fail more or less 2 weeks ago.
It was working perfectly fine beforehand and I can’t find a way around it. It seems to be picking up the wrong nodejs version and I’m not able to find how to provide the correct one.

  • ALM used Bitbucket Cloud
  • CI system used Bitbucket Cloud
  • Languages : NX Mono repo : NestJS, React, Nodejs
  • Error observed :

→ When no “sonar.nodejs.executable” provided in sonar-project.properties

ERROR: Only Node.js v12.22 or later is supported, got 12.18.3.
org.sonarsource.nodejs.NodeCommandException: Only Node.js v12.22 or later is supported, got 12.18.3. 

And this, even though I provided this line to “bitbucket-pipelines.yml” :

image: node:lts 

→ If I try to use “sonar.nodejs.executable” propriety, I end up with errors like :

ERROR: Provided Node.js executable file does not exist. Property 'sonar.nodejs.executable' was set to '/usr/bin/node'
ERROR: Provided Node.js executable file does not exist.
org.sonarsource.nodejs.NodeCommandException: Provided Node.js executable file does not exist.

I don’t really understand what I’m doing wrong and would appreciate if someone is kind enough to help :slight_smile:

Hi,

Welcome to the community!

This sounds like some sort of path resolution problem…? What are you providing as the sonar.nodejs.executable value?

 
Ann

Hello Ann ! Thanks for your time

I was not sure where node is on the bitbucket server, so I tried a few different stuff.
From what I read online, I though that “sonar.nodejs.executable=/usr/bin/node” would be the correct one but it doesn’t work

Hi,

With a path like /usr/bin/node I guess you’re running on Linux? Can you try whereis node or which node (assuming node is the right command)?

 
Ann

Hello,

So I investigated following to your comment, and turns out I didn’t understood how the pipe worked.
Even if the nodejs version was good (Checked using “node -v” & “whereis node”) on the bitbucket file itself, the “pipe: sonarsource/sonarcloud-scan:1.2.0” was using a wrong version. Upgrading to the following fixed the issue :

- pipe: sonarsource/sonarcloud-scan:1.4.0
                    variables:
                        SONAR_SCANNER_OPTS: -Xmx256m

I also remove the “sonar.nodejs.executable” line in sonar-project.propreties

Thanks for your help, it is now fixed

1 Like

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