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