Skip to content

Instantly share code, notes, and snippets.

@DMeechan
Created December 20, 2017 11:47
Show Gist options
  • Save DMeechan/2f6e962622c3387785bb2e44298a153c to your computer and use it in GitHub Desktop.
Save DMeechan/2f6e962622c3387785bb2e44298a153c to your computer and use it in GitHub Desktop.
Updating Node.js on IBM Cloud Delivery Pipeline
#!/bin/bash
# Credit: http://gh-blog.mybluemix.net/blogs/cokeSchlumpf/rethink-it/posts/bluemix/node-buildpipeline.md?cm_sp=dw-bluemix-_-nospace-_-answers
# Paste the script below into IBM Cloud Delivery Pipeline Build process (shell script)
# Set your Node and NVM version:
export NODE_VERSION=8.9.3
export NVM_VERSION=0.33.8
export NVM_DIR=/home/pipeline/nvm
METEOR_HOME=.meteor/local
PATH=$METEOR_HOME/usr/bin:$METEOR_HOME/usr/lib/meteor/bin:$PATH
update_node() {
npm config delete prefix \
&& curl https://raw.githubusercontent.com/creationix/nvm/v${NVM_VERSION}/install.sh | sh \
&& . $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default \
&& node -v \
&& npm -v
npm install
}
@DMeechan
Copy link
Author

DMeechan commented Dec 20, 2017

In your Build Stage on the IBM Cloud Continuous Delivery Pipeline:

  1. Create a 'Build' job
  2. Choose Shell script
  3. Paste the script above in
  4. Update Node version in the script and then run

@leonimurilo
Copy link

I can't believe that the highest version available today is 6.x... It really feels like if IBM had abandoned the service since the current node version (LTS and L) are way higher.

@skaegi
Copy link

skaegi commented Nov 9, 2018

I assure you that is not the case. Just crazy growing pains... The team had to freeze the versions to prevent breaking existing pipelines. A new approach to managing this stuff is coming out shortly.

@pheuberger
Copy link

@skaegi The currently highest pre-installed version is reaching its end of life in April this year. Might be a nice deadline for the new approach to see a release 😉

@dljenkins
Copy link

I ran into the same problem of needing a newer version to compile. Here is the beginning of my npm build script that installs the version of node and npm I need.

#!/bin/bash
#install n module to $HOME/.npm-global/bin/n
export PREFIX=./
npm install -g n
ls -l $HOME/.npm-global/bin

#install node to ./node/8.9.3
export N_PREFIX=$PWD/node
$HOME/.npm-global/bin/n 8.9.3
ls -l $N_PREFIX/n/versions/node

#set node path
export PATH=$N_PREFIX/n/versions/node/8.9.3/bin:$PATH

#set npm version
npm install -g npm@5.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment