Jenkins中shell-script执行报错sh: line 2: npm: command not found
<1>本地执行npm run build--正常
<2>查看环境变量--正常
[root@localhost bin]# echo $PATH
/usr/local/node/bin:/usr/local/nginx/sbin:/usr/local/node/bin:
<3>将shell中的script的npm command换成绝对路径
报错:/usr/bin/env: node: No such file or directory
解决办法:
添加node软链接:
ln -s /usr/local/node/bin/node /usr/bin/node
如果还是不行,在commond前面加上:
#!/bin/bash -ilex