Pm2: Deploy post-deploy command's not found

Created on 13 Jan 2016  路  3Comments  路  Source: Unitech/pm2

I have a post-deploy line like sudo npm install && gulp && sudo pm2 startOrRestart ecosystem.json5 --env staging

When I'm in the server, I can run this command without problem. However for some reason when run in the post-deploy, I always get that the gulp command is not found.

Would this be run as a different user? Can't seem to figure out why this would be the case.

Most helpful comment

@webchaz @soyuka Alright in my case I commented out blocking non-interactive mode and added my PATH to /etc/bash.bashrc and it's working.

export PATH=~/.npm-global/bin:$PATH

# System-wide .bashrc file for interactive bash(1) shells.

# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.

# If not running interactively, don't do anything
#[ -z "$PS1" ] && return

All 3 comments

Is it that gulp is not in the path or that the local gulp can not be found?

Anyway, use a relative or absolute path to the gulp binary if you can.

https://github.com/Unitech/pm2-deploy/issues/41 This seems to be the case but I can't get it working even after commenting out the non-interactive ssh part.

In my case I had this in ~/.bashrc

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

and this in /etc/bash.bashrc

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

@webchaz @soyuka Alright in my case I commented out blocking non-interactive mode and added my PATH to /etc/bash.bashrc and it's working.

export PATH=~/.npm-global/bin:$PATH

# System-wide .bashrc file for interactive bash(1) shells.

# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.

# If not running interactively, don't do anything
#[ -z "$PS1" ] && return
Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexpts picture alexpts  路  3Comments

cchan picture cchan  路  3Comments

ghost picture ghost  路  3Comments

morfies picture morfies  路  3Comments

getvega picture getvega  路  3Comments