Reputation: 615
I am working on an existing job that builds a project using node but it looks like it will need to run on v8.11.1 specifically.
here are the following commands we use on Jenkins:
source ~/.profile
echo 'Install required packages'
npm install -g bower gulp nodemon
npm install
bower install
echo 'Building production code'
gulp build
It build our project successfully but only uses version 6.11.2
/home/jenkins/.nvm/versions/node/v6.11.2/bin/bower -> /home/jenkins/.nvm/versions/node/v6.11.2/lib/node_modules/bower/bin/bower
/home/jenkins/.nvm/versions/node/v6.11.2/bin/gulp -> /home/jenkins/.nvm/versions/node/v6.11.2/lib/node_modules/gulp/bin/gulp.js
/home/jenkins/.nvm/versions/node/v6.11.2/bin/nodemon -> /home/jenkins/.nvm/versions/node/v6.11.2/lib/node_modules/nodemon/bin/nodemon.js
I have tried downloading node v8.11.1 to the /home/jenkins/.nvm/versions/node/, copying gulp, nodemon and bower to the bin directories and using nvm alias default v8.11.1
to switch my node versions
Though, when I run the project it always runs on the older version. What could I do to force it to run to the 8.11.1 version?
Upvotes: 2
Views: 3275
Reputation: 535
You may need to restart Jenkins for it to start using/recognize the newer version of node.
Upvotes: 1