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.
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
Most helpful comment
@webchaz @soyuka Alright in my case I commented out blocking non-interactive mode and added my PATH to
/etc/bash.bashrcand it's working.