1

I m trying to automatically run "npm install" and "pm2 restart all" whenever codeship deployed my codes onto DigitalOcean.

This is the custom script:

rsync -avz -e "ssh" ~/clone/ root@IP:/opt/projectname
ssh root@IP 'cd /opt/projectname/; npm install; pm2 restart all'

The rsync works. Codes will be deployed onto the correct folder on DigitalOcean.

However, the second line fails. Error:

bash: npm: command not found
bash: pm2: command not found

Why?

mkto
  • 4,584
  • 5
  • 41
  • 65
  • I will see if I can figure out what's happening here - but most likely on the Digital Ocean side of things. – Kelly J Andrews Nov 21 '17 at 21:32
  • I have the same issue, @mkto did you found a solution ? Thanks – Diego Laciar Jun 20 '18 at 18:52
  • This has to do with some weird shit going on with where codeship enters the server. I've had this issue as well, and solved it with having an absolute path to the npm and pm2 binaries. For example. /usr/local/bin/pm2 start keystone.js – Askdesigners Sep 29 '18 at 10:18

0 Answers0