Skip to content
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

Merged
merged 3 commits into from
Jan 14, 2014
Merged

export NODE_PATH on nvm use #342

merged 3 commits into from
Jan 14, 2014

Conversation

txgruppi
Copy link
Contributor

@txgruppi txgruppi commented Jan 1, 2014

Added a line to export NODE_PATH variable to solve the not found error for global packages

@@ -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"
Copy link
Member

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?

@txgruppi
Copy link
Contributor Author

txgruppi commented Jan 1, 2014

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}"
Copy link
Member

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}" ?

@txgruppi
Copy link
Contributor Author

I removed the PREVIOUS_NODE_PATH variable but i still had to use a variable RUN_NODE_PATH

I tested with the variable NODE_PATH and it was changing on the shell

ps: sorry about some possible english mistakes

@ljharb
Copy link
Member

ljharb commented Jan 14, 2014

Tested locally; works for me.

ljharb added a commit that referenced this pull request Jan 14, 2014
export NODE_PATH on nvm use
@ljharb ljharb merged commit 45eff43 into nvm-sh:master Jan 14, 2014
@ljharb
Copy link
Member

ljharb commented Nov 30, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants