Ensure that if npm config get prefix is set to something outside nvm, that nvm use refuses to work.

Fixes #606.
This commit is contained in:
Jordan Harband
2015-09-21 04:47:37 -07:00
parent a1def71062
commit 1458de7293
4 changed files with 57 additions and 3 deletions

View File

@@ -7,7 +7,7 @@ die () { echo $@ ; exit 1; }
[ `expr $PATH : ".*v0.2.3/.*/bin"` = 0 ] || echo "WARNING: Unexpectedly found v0.2.3 already active" >&2
. ../../nvm.sh
nvm use v0.2.3 || die "Failed to activate v0.2.3"
nvm use --delete-prefix v0.2.3 || die "Failed to activate v0.2.3"
[ `expr "$PATH" : ".*v0.2.3/.*/bin"` != 0 ] || die "PATH not set up properly"
[ `expr "$NODE_PATH" : ".*v0.2.3/.*/lib/node_modules"` = 0 ] || die "NODE_PATH should not contain (npm root -g)"
# ^ note: NODE_PATH should not contain `npm root -g` since globals should not be requireable