Errors when running node/npm tasks

Hi, I’m stuck with my “angular” buildkite pipeline.

This is my simple pipeline

steps:
  - label: "..."
    command:
      - "whoami"
      - "node -v"
      - "npm install"
      - "npm run build:prod"

When I run this pipeline I obtain an error with “node” and “npm” commands… take a look at the buildkite output :

$ whoami
node -v
npm install
npm run build:prod
ec2-user
/bin/bash: line 2: node: command not found
🚨 Error: The command exited with status 127
user command error: exit status 127

As you can see this is the error : “/bin/bash: line 2: node: command not found

It seems that “node” is not installed in my agent machine, right?

But, as you can see below, “node” and “npm” are installed and running inside my agent machine :

[ec2-user@ip-10-0-1-97 ~]$ whoami
ec2-user

[ec2-user@ip-10-0-1-97 ~]$ node -v
v18.20.4

[ec2-user@ip-10-0-1-97 ~]$ npm -v
10.7.0

Could you help me in addressing this kind of issue?

Any kind of suggestion will be very appreciated!

Thank you.

Hey @sergio.belli :wave:,

This is Suma from Buildkite support team. First of all welcome to Buildkite community and thank you for reaching out to us with your question.

From the output you shared if the build step ran on the same instance where you share the output of node and npm commands then it should work.

Please can you check the timeline tab in Buildkite UI of the job where this step ran to confirm it indeed ran on the same instance ?

If yes, please can you send the build url to support@buildkite.com so we can check further to see why this did not as unless the build ran on different instance than the one you check the commands this should work.

Thanks,
Suma

Hi Suma,
thank you for the welcome and for the quick reponse.

I can assure that the job runs on the same instance where I connect via ssh and ran node and nom commands.
Is it assured because is the only one instance which as been provided of the Builkite agent.

This is the build url : https://buildkite.com/welfin-dot-it/piattaforma-prestiti-backoffice-release/builds/21#0191e678-572a-47ee-ac52-89248f86c598.
I will send it via e-mail providing the title of this ticket, right?

Thank you, best regards
Sergio