Skip to content

Instantly share code, notes, and snippets.

@fraserxu
Last active January 7, 2017 23:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fraserxu/07fdafd1477f55a636c2d4692f8ba75f to your computer and use it in GitHub Desktop.
Save fraserxu/07fdafd1477f55a636c2d4692f8ba75f to your computer and use it in GitHub Desktop.
npm versioning in nodenv
#!/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