我正在尝试在 Ubuntu 服务器上安装和使用 Jenkins 执行 shell 脚本中的 nvm,但出现此错误:
16:00:21 /tmp/hudson5983664925305072739.sh: line 8: nvm: command not found
这是我到目前为止尝试过但没有成功的方法:
#!/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 执行 shell 截图:
最佳答案
添加这些可以解决问题:
. ~/.nvm/nvm.sh
. ~/.profile
. ~/.bashrc
关于ubuntu - NVM 不适用于 Jenkins execute shell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42627037/