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
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
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 :