Last active
January 7, 2017 23:00
-
-
Save fraserxu/07fdafd1477f55a636c2d4692f8ba75f to your computer and use it in GitHub Desktop.
npm versioning in nodenv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# /opt/boxen/nodenv/versions/4.4.4/bin/node | |
NODE_BIN_DIR="$(nodenv which node)" | |
# /opt/boxen/nodenv/versions/4.4.4/lib | |
NODE_LIB_DIR="${NODE_BIN_DIR%%bin*node}lib" | |
install_npm() { | |
local version="$1" | |
pushd "$NODE_LIB_DIR" >/dev/null | |
npm install npm@$version | |
popd >/dev/null | |
} | |
echo "Setup npm dependencies..." | |
install_npm 3.5.3 | |
npm prune | |
npm rebuild | |
npm install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment