Global modules should not be requireable, and `npm root -g` should not be in `$NODE_PATH`.
Fixes #586.master
parent
052743816f
commit
383f39ab61
9
nvm.sh
9
nvm.sh
|
@ -790,9 +790,7 @@ nvm() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
NEWPATH="$(nvm_strip_path "$NODE_PATH" "/lib/node_modules")"
|
NEWPATH="$(nvm_strip_path "$NODE_PATH" "/lib/node_modules")"
|
||||||
if [ "$NODE_PATH" = "$NEWPATH" ]; then
|
if [ "$NODE_PATH" != "$NEWPATH" ]; then
|
||||||
echo "Could not find $NVM_DIR/*/lib/node_modules in \$NODE_PATH" >&2
|
|
||||||
else
|
|
||||||
export NODE_PATH="$NEWPATH"
|
export NODE_PATH="$NEWPATH"
|
||||||
echo "$NVM_DIR/*/lib/node_modules removed from \$NODE_PATH"
|
echo "$NVM_DIR/*/lib/node_modules removed from \$NODE_PATH"
|
||||||
fi
|
fi
|
||||||
|
@ -850,13 +848,8 @@ nvm() {
|
||||||
MANPATH=`nvm_prepend_path "$MANPATH" "$NVM_VERSION_DIR/share/man"`
|
MANPATH=`nvm_prepend_path "$MANPATH" "$NVM_VERSION_DIR/share/man"`
|
||||||
export MANPATH
|
export MANPATH
|
||||||
fi
|
fi
|
||||||
# Strip other version from NODE_PATH
|
|
||||||
NODE_PATH=`nvm_strip_path "$NODE_PATH" "/lib/node_modules"`
|
|
||||||
# Prepend current version
|
|
||||||
NODE_PATH=`nvm_prepend_path "$NODE_PATH" "$NVM_VERSION_DIR/lib/node_modules"`
|
|
||||||
export PATH
|
export PATH
|
||||||
hash -r
|
hash -r
|
||||||
export NODE_PATH
|
|
||||||
export NVM_PATH="$NVM_VERSION_DIR/lib/node"
|
export NVM_PATH="$NVM_VERSION_DIR/lib/node"
|
||||||
export NVM_BIN="$NVM_VERSION_DIR/bin"
|
export NVM_BIN="$NVM_VERSION_DIR/bin"
|
||||||
if [ "$NVM_SYMLINK_CURRENT" = true ]; then
|
if [ "$NVM_SYMLINK_CURRENT" = true ]; then
|
||||||
|
|
|
@ -8,7 +8,8 @@ die () { echo $@ ; exit 1; }
|
||||||
|
|
||||||
. ../../nvm.sh
|
. ../../nvm.sh
|
||||||
nvm use v0.2.3 &&
|
nvm use v0.2.3 &&
|
||||||
[ `expr $PATH : ".*v0.2.3/.*/bin"` != 0 ] && [ `expr $NODE_PATH : ".*v0.2.3/.*/lib/node_modules"` != 0 ] || die "Failed to activate v0.2.3"
|
[ `expr $PATH : ".*v0.2.3/.*/bin"` != 0 ] && [ `expr $NODE_PATH : ".*v0.2.3/.*/lib/node_modules"` = 0 ] || die "Failed to activate v0.2.3"
|
||||||
|
# ^ note: NODE_PATH should not contain `npm root -g` since globals should not be requireable
|
||||||
|
|
||||||
nvm deactivate &&
|
nvm deactivate &&
|
||||||
[ `expr $PATH : ".*v0.2.3/.*/bin"` = 0 ] && [ `expr $NODE_PATH : ".*v0.2.3/.*/lib/node_modules"` = 0 ] || die "Failed to deactivate v0.2.3"
|
[ `expr $PATH : ".*v0.2.3/.*/bin"` = 0 ] && [ `expr $NODE_PATH : ".*v0.2.3/.*/lib/node_modules"` = 0 ] || die "Failed to deactivate v0.2.3"
|
||||||
|
|
Loading…
Reference in New Issue