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

Pipeline runner: How do I use commands like npm?

Tomer Horowitz
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 1, 2023

I am trying to run a bitbucket pipeline runner on my macOS computer in order to build my react native application using fastlane. 

 

Manually I know I have all the deps I need like npm, xcode, etc but when I try to run an npm install or something, I get an error "npm is not a known command", I have also checked the path and the installation directory is not in it.

 

So my question is how do I use (for example) the npm that is installed on the macos computer my runner runs on in my pipelines.

 

Thank you.

2 answers

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 4, 2023

Hi Tomer and welcome to the community!

MacOS Runners do not use Docker containers, they use Bash to run pipeline steps on your MacOS machine (host device).

If a certain tool is installed on your MacOS and you can use it in Bash outside the runner, you should be able to use it with the runner as well.

You mentioned that the installation directory of npm is not in the $PATH, so it sounds like this may be the reason why the command cannot be found.

I would suggest the following:

  1. add the installation directory in the $PATH
  2. restart the terminal (including the one running the runner)
  3. ensure you can run npm commands without the runner
  4. then start the runner and try to run your build again

Kind regards,
Theodora

0 votes
Erez Maadani
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.
July 2, 2023

Hi @Tomer Horowitz 

Your macOS is a runner which runs bitbucket pipelines which spawn containers for each step.

It sounds like the image the step is using, does not have npm installed or npm is not in its PATH.

To verify it, pull the image locally (to your macOS), run it interactively and try running the command "npm -v".  

Hope that helps 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events