pm2 icon indicating copy to clipboard operation
pm2 copied to clipboard

post deploy hook failed- bash: npm: command not found

Open jtoronto opened this issue 2 years ago • 3 comments

What's going wrong?

When deploying to a remote machine using pm2 deploy server if fails on the post deploy hook where I am running the following

'post-deploy': `npm install && pm2 startOrRestart ecosystem.config.js --update-env --env development`,

Results in "

 ○ executing post-deploy `npm install && pm2 startOrRestart ecosystem.config.js --update-env --env development`
bash: npm: command not found

  post-deploy hook failed

Deploy failed
Deploy failed with exit code: 1

I can SSH into the machine and manually run the commands in the post-deploy hook and they work fine. It just doesn't work when deploying. This is one of 4 environments of essentially identical machines in the same ecosystem.config.js file, only this one has an issue. Not sure where to start.

jtoronto avatar Jun 28 '22 17:06 jtoronto

Same problem here. Any news about it?

leobaldoneto avatar Nov 24 '22 15:11 leobaldoneto

I have the same issue. My prod server deploys with no errors but not my dev server. On Dev server running: Ubuntu 22.04.1 LTS PM2 5.2.2

On Prod server running: Ubuntu 18.04.6 LTS PM2 3.4.1

fenriquez1 avatar Dec 28 '22 13:12 fenriquez1

Any news ?

raulfortes avatar Jan 26 '24 14:01 raulfortes