-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
export NODE_PATH on nvm use #342
Conversation
@@ -421,6 +421,7 @@ nvm() { | |||
export MANPATH | |||
export NVM_PATH="$NVM_DIR/$VERSION/lib/node" | |||
export NVM_BIN="$NVM_DIR/$VERSION/bin" | |||
export NODE_PATH="$NVM_DIR/$VERSION/lib/node_modules" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will need to be unset when nvm deactivate
is called - should it also be set as part of the nvm run
command?
Updated to change NODE_PATH variable on use, run and deactivate |
else | ||
NODE_PATH="$NVM_DIR/$VERSION/lib/node_modules:$NODE_PATH" | ||
fi | ||
export NODE_PATH | ||
echo "Running node $VERSION" | ||
$NVM_DIR/$VERSION/bin/node "${@:3}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of the PREVIOUS_NODE_PATH stuff you could just run NODE_PATH=foo $NVM_DIR/$VERSION/bin/node "${@:3}"
?
I removed the I tested with the variable NODE_PATH and it was changing on the shell ps: sorry about some possible english mistakes |
Tested locally; works for me. |
Turns out this should never have been added - global modules should not be requireable, ever. If it's a dependency, it should be an explicit dependency. Reverted as part of #586. |
Added a line to export NODE_PATH variable to solve the not found error for global packages