I am trying to install and use nvm from the Jenkins execute shell script on Ubuntu server but I am getting this error:
16:00:21 /tmp/hudson5983664925305072739.sh: line 8: nvm: command not found
This is what I have tried those so far but no success:
#!/bin/bash
touch ~/.profile && source ~/.profile;
nvm current || echo "SSH NVM is being installed" && touch ~/.profile && curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh -o install_nvm.sh && bash install_nvm.sh && source ~/.profile
echo "checking nvm"
bash ~/.nvm/nvm.sh;
nvm --version || exit 1;
Jenkins execute shell screenshot:
Adding those solves the issue:
. ~/.nvm/nvm.sh
. ~/.profile
. ~/.bashrc