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

NVM command not found from bamboo plan but works in local

Mahesh June 10, 2024

Hi There,

I have installed NVM in my ubuntu build agent. I am able to use nvm and node commands in my local.

But when I run nvm or node commands from bamboo plan, Plan fails with error as node command not found. Same for nvm also.

When I use full path for node it works. 

/opt/bamboo-agent-home/.nvm/versions/node/v12.21.0/bin/node -v

But nvm is not working. please suggest.

Error : 
/opt/bamboo-agent-home/temp/TEST-SCR-LT-71-ScriptBuildTask-47945519012.sh: 9: /opt/bamboo-agent-home/temp/TEST-SCR-LT-71-ScriptBuildTask-47945519012.sh: nvm: not found

1 answer

1 vote
Shashank Kumar
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 10, 2024

Hello Mahesh,

Welcome to Atlassian community

You can try the below 2 things.

1. Install nvm in a location using the user which is running the Bamboo agent and is location is accesible to the bamboo user which is running the agent.

2. After Installing check if nvm is getting listed in the capabilities of the agent, if not try restarting the agent and check.

3. If that does not work too, try defining the capabilities manually 

Post all the above steps try a simple script task with command nvm --version and let me know the results.

Regards,

Shashank Kumar

Mahesh June 10, 2024

Hi @Shashank Kumar ,
Thanks for the reply.

I installed nvm using command "curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash" 

It is not listed in capabilities. After restart also same it is not listed.

Tried to add nvm path in capabilities but i am not able to find the nvm executable. Which one to be added as executable ???

Shashank Kumar
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 11, 2024

Hello Mahesh,

nvm is a shell function and not a shell executable file so you'll not be able to add it as a executable.

There are few options which you can work with.

1. Add the below entry in .profile file in your linux box. 

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

2. Or add it in the script task ( like attached )

image.png

When you run this script task, you should be able to see the results.

Regards,

Shashank Kumar

**please don't forget to Accept the answer if your query was answered**

Like Steffen Opel _Utoolity_ likes this
Mahesh June 12, 2024

Hi @Shashank Kumar ,

By adding this I can see nvm version, When I use node command again it says command not found. In local can see node version. and it can be managed by only "nvm use --delete-prefix v16.20.2"  simple nvm use 16 command is not working.

It throws error as below.

bam:~$ nvm use 16
nvm is not compatible with the npm config "prefix" option: currently set to "/data/home/bambooagent/.nvm/versions/node/v16.20.2"
Run `nvm use --delete-prefix v16.20.2` to unset it.
bam:~$

node command error : 848876677.sh: node: not found

Mahesh June 16, 2024

@Shashank Kumar 

Any suggestions here

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events