I'm writing a script which at one point starts a simple node.js based website:
cd ../ap-site/ && npm start
When I run the above command from terminal there is no problem, but when run from my script I get:
/usr/bin/env: node: No such file or directory
I'm using nvm to manage node versions currently, so I tried adding
nvm use 8.8.1 to my
~/.bashrc and then sourcing the file in my script directly:
source /home/rescue/.bashrc cd ../ap-site/ && npm start
I also tried using
which npm in terminal and using the resulting path directly like:
cd ../ap-site/ && /home/rescue/.nvm/v8.8.1/bin/npm start
But I got the same result.
Any ideas on how I can debug the situation and run node projects from my bash script?