From 68f57ac455508340d451b3e25a854dfba0d9a78c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caio=20Rom=C3=A3o?= Date: Wed, 18 Jan 2012 17:37:31 -0200 Subject: [PATCH] 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. --- nvm.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/nvm.sh b/nvm.sh index 6d589d8..98b2d1b 100755 --- a/nvm.sh +++ b/nvm.sh @@ -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" )