always apply path stripping

master
Koen Punt 2014-05-06 00:00:25 +02:00
parent 0d81a219ae
commit 652a9ef9b5
1 changed files with 10 additions and 15 deletions

11
nvm.sh
View File

@ -471,23 +471,20 @@ nvm() {
echo "$VERSION version is not installed yet" echo "$VERSION version is not installed yet"
return 1 return 1
fi fi
if [ `expr "$PATH" : ".*$NVM_DIR/.*/bin"` != 0 ]; then
# Strip other version from PATH # Strip other version from PATH
PATH=`nvm_strip_path "$PATH" "/bin"` PATH=`nvm_strip_path "$PATH" "/bin"`
fi # Prepend current version
PATH="$NVM_DIR/$VERSION/bin:$PATH" PATH="$NVM_DIR/$VERSION/bin:$PATH"
if [ -z "$MANPATH" ]; then if [ -z "$MANPATH" ]; then
MANPATH=$(manpath) MANPATH=$(manpath)
fi fi
if [ `expr "$MANPATH" : ".*$NVM_DIR/.*/share/man"` != 0 ]; then
# Strip other version from MANPATH # Strip other version from MANPATH
MANPATH=`nvm_strip_path "$MANPATH" "/share/man"` MANPATH=`nvm_strip_path "$MANPATH" "/share/man"`
fi # Prepend current version
MANPATH="$NVM_DIR/$VERSION/share/man:$MANPATH" MANPATH="$NVM_DIR/$VERSION/share/man:$MANPATH"
if [ `expr "$NODE_PATH" : ".*$NVM_DIR/.*/lib/node_modules.*"` != 0 ]; then
# Strip other version from NODE_PATH # Strip other version from NODE_PATH
NODE_PATH=`nvm_strip_path "$NODE_PATH" "/lib/node_modules"` NODE_PATH=`nvm_strip_path "$NODE_PATH" "/lib/node_modules"`
fi # Prepend current version
NODE_PATH="$NVM_DIR/$VERSION/lib/node_modules:$NODE_PATH" NODE_PATH="$NVM_DIR/$VERSION/lib/node_modules:$NODE_PATH"
export PATH export PATH
hash -r hash -r
@ -533,9 +530,7 @@ nvm() {
echo "$VERSION version is not installed yet" echo "$VERSION version is not installed yet"
return; return;
fi fi
if [ `expr "$NODE_PATH" : ".*$NVM_DIR/.*/lib/node_modules.*"` != 0 ]; then
RUN_NODE_PATH=`nvm_strip_path "$NODE_PATH" "/lib/node_modules"` RUN_NODE_PATH=`nvm_strip_path "$NODE_PATH" "/lib/node_modules"`
fi
RUN_NODE_PATH="$NVM_DIR/$VERSION/lib/node_modules:$NODE_PATH" RUN_NODE_PATH="$NVM_DIR/$VERSION/lib/node_modules:$NODE_PATH"
echo "Running node $VERSION" echo "Running node $VERSION"
NODE_PATH=$RUN_NODE_PATH $NVM_DIR/$VERSION/bin/node "$@" NODE_PATH=$RUN_NODE_PATH $NVM_DIR/$VERSION/bin/node "$@"