I have an idea of what the problem is, but I don't know how to fix it. My issue is that when I run the script post-receive, I get the error env: node: No such file or directory.
I think it may be because its a non-interactive shell and that I should change the $PATH, but I don't understand enough to know what I need to do. When I source the file, npm works without any issues. It only occurs when I call the script elsewhere remotely.
I'm using homebrew, nodev8, and postgres. I also have nvm managing node.
Here is my script:
#!/usr/bin/env bash . $NVM_DIR/nvm.sh echo 'post-receive: Triggered.' cd /Users/david/Development/abba/live/404 echo 'post-receive: git check out...' git --git-dir=/Users/david/Development/abba/404.git --work-tree=/Users/david/Development/abba/live/404 checkout master -f /Users/david/.nvm/v8.15.0/bin/npm install && echo 'post-receive: -> done.' Environment:
which node # /Users/david/.nvm/v8.15.0/bin/node echo $PATH # /Users/david/.nvm/v8.15.0/bin:/usr/local/opt/node@8/bin:/usr/local/opt/node@8/bin:/usr/local/opt/node@8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/node@8/bin:/usr/local/opt/node@8/bin .bash_profile:
export PATH="/usr/local/opt/node@8/bin:" export NVM_DIR="/Users/david/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm