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
}
@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