My current task is to make a Jenkins job which will download a git repo, will gulp build a project and finally will sync data to an S3 bucket. My trouble is with gulp build command which root can't find.
I read that post about installing nvm globally and after using:
wget -qO- https://raw.githubusercontent.com/xtuple/nvm/master/install.sh | sudo bash
was able to install nvm to /usr/local/nvm.
Inside the project directory (/var/lib/jenkins/project) I run:
sudo /usr/local/bin/npm install
and all modules go to node_modules dir inside project dir.
Then I do:
sudo gulp build --env=production
sudo: gulp: command not found
It looks like root can't find gulp. Inside node_modules/gulp/bin there is a gulp.js file but I have no idea how to use it.
So how can I make gulp build work for root? Previously I installed and build the project with a minor effort using a regular user and I know the project is ok, the problem manifested after switching to root.
My working env is Amazon Linux with node.js version 4.4.7. These are my first steps with nvm, gulp and node.js as a whole, so please, don't be too harsh if I'm doing something obviously stupid.