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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Running shell command with a Script task not in place

I want to run the command npm run myScript within my built plan, with an Inline Script task, but I'm getting an error that npm was not found:

/mnt/data/bamboo-home/temp/ESR-WRITETEST5-JOB1-4-ScriptBuildTask-3554693384958793235.sh: 1: /mnt/data/bamboo-home/temp/ESR-WRITETEST5-JOB1-4-ScriptBuildTask-3554693384958793235.sh: npm: not found

When on localhost, I need to be within the /app directory in my project, in order to run npm commands. Apparently Bamboo puts the script in a temporary folder, outside of the project, thus npm is not found. Do you know how to overcome this issue?

This is the configuration of the task:

Screen Shot 2016-12-29 at 12.32.56.png

1 answer

Galin,

Just so you know there is a npm task available which you can use to run the npm tasks.

But for your question: you need to tell bamboo where your node is installed. I have definied a variable as npm and this is how I use if I want to use it in inline script

 

Variable:

  
npm

/home/(company_dir)/tools/node_js/node-v4.4.0-linux-x64/bin/node

/home/(company_dir)/tools/node_js/node-v4.4.0-linux-x64/bin/npm

 

script :

 ${bamboo.npm} run init-test-db

 

You can do this or directly write those values in script

That should work!

FYI

image2016-12-29 9:29:38.png

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo 7.1 is here and is packed with value!

I'm happy to announce that Bamboo 7.1 has been released and it’s overflowing with awesome new features. Top-voted issues First and foremost, a bunch of JAC top voted issues has been delivered - y...

588 views 1 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you