【发布时间】:2019-03-05 15:16:36
【问题描述】:
我在 shell 中使用 pm2,它工作正常。但是当我将它添加到.travis.yml 时,它会显示给我
$ pm2 restart index.js
No command 'pm2' found
pm2 在/usr/local/bin 中,当我回显$PATH 时,它包含路径/usr/local/bin。我对此一无所知。
.travis.yml
language: node_js
node_js:
- 8.9.1
branchs:
only:
- master
cache:
apt: true
directories:
- node_modules
install:
- git pull
- rm -f package-lock.json && npm install
script:
- echo $PATH
- pm2 restart index.js
after_success:
- chmod 600 ~/.ssh/id_rsa
before_install:
- openssl aes-256-cbc -K $encrypted_a46a360c8512_key -iv $encrypted_a46a360c8512_iv
-in id_rsa.enc -out ~/.ssh/id_rsa -d
【问题讨论】:
-
pm2 已安装在您的本地计算机中。您需要关注此stackoverflow.com/questions/27837455/… 并在 tavis 的 yaml 文件中添加 pm2 安装