jenkins执行shell提示命令不存在


问题描述:

  jenkins编译项目,不继承linux环境变量 ~/.bash_profile  ~/.bashrc  /etc/profile,导致在执行shell脚本,提示命令找不到! 

[sz-hgzx-web] $ /bin/sh -xe /home/jenkins/jenkins-tomcat/temp/jenkins3481283604636839646.sh
+ cd hgzx-web-deploy/hgzx-front
+ npm run build sz
/home/jenkins/jenkins-tomcat/temp/jenkins3481283604636839646.sh: line 3: npm: command not found //npm命令找不到
Build step '执行 shell' marked build as failure
Finished: FAILURE

问题解决:

00、之前脚本前执行环境变量的刷新

  source /etc/profile

  source ~/.bash_profile

11、建立标准软连接

  ln -sv xxx/bin/node /usr/local/bin/node

  ln -sv xxx/bin/npm /usr/local/bin/npm




					


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM