1 parent 84b4aec commit c86f8bdCopy full SHA for c86f8bd
1 file changed
scripts/install_node.sh
@@ -1,9 +1,21 @@
1
+#!/usr/bin/env bash
2
+
3
+if [[ ${1:-false} == 'false' ]]; then
4
+ echo "Error: pass node version as first argument"
5
+ exit 1
6
+fi
7
8
+NODE_VERSION=$1
9
10
+# if an existing nvm is already installed we need to unload it
11
+nvm unload || true
12
13
# here we set up the node version on the fly based on the matrix value.
14
# This is done manually so that the build works the same on OS X
-rm -rf ~/.nvm/ && git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm
-source ~/.nvm/nvm.sh
-nvm install $1
-nvm use $1
15
+rm -rf ./__nvm/ && git clone --depth 1 https://github.com/creationix/nvm.git ./__nvm
16
+source ./__nvm/nvm.sh
17
+nvm install ${NODE_VERSION}
18
+nvm use ${NODE_VERSION}
19
node --version
20
npm --version
-which node
21
+which node
0 commit comments