Set the NODE_PATH variable when activating node

When installing packages with npm using the global switch `-g` the package ends
up in the proper directory (i.e. .nvm/$VERSION/lib/node_modules), however node
is unable to require it since it somehow isn't searching on it's prefix.

This patch fixes this behavior by manually adding the `node_modules` dir to the
`NODE_PATH` variable.
This commit is contained in:
Caio Romão 2012-01-18 17:37:31 -02:00
parent ec2327fddd
commit 68f57ac455

1
nvm.sh
View File

@ -197,6 +197,7 @@ nvm()
export MANPATH
export NVM_PATH="$NVM_DIR/$VERSION/lib/node"
export NVM_BIN="$NVM_DIR/$VERSION/bin"
export NODE_PATH="$NODE_PATH:$NVM_DIR/$VERSION/lib/node_modules"
echo "Now using node $VERSION"
;;
"run" )