Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Use $NODE_PATH if it's set #9

Closed
creationix opened this Issue May 6, 2010 · 5 comments

Comments

Projects
None yet
2 participants
Contributor

creationix commented May 6, 2010

If the user has set a local $NODE_PATH, use that instead of $HOME/.node_libraries for installing modules. This will make npm play nicely with nvm.

Contributor

creationix commented May 6, 2010

Also, I just saw that a new version of node came out that looks for modules in $PREFIX/lib/node, I just updated nvm to use this for it's $NODE_PATH directory. So if you default to the global $PREFIX based location that will work for me too.

Owner

isaacs commented May 6, 2010

That's a great idea.

If you run npm with sudo, it'll default to $PREFIX/lib/node. If not, it'll default to $HOME/.node_libraries.

But it would be good to check the $NODE_PATH, and do something smart with it. At the very least, npm should make sure that the --root setting is in the $NODE_PATH, and show some kind of warning if it's not.

Contributor

creationix commented May 6, 2010

the sudo check doesn't work for my case since my $PREFIX is in my home folder. I imagine others do this too. Maybe try to write to the global library folder and fallback to $HOME/.node_libraries if it's not possible.

Owner

isaacs commented May 6, 2010

Discussed in IM:

  1. When not sudo, use require.paths[0]
  2. When sudo, use process.installPrefix+"/lib/node"

This also ensures that the --root config is in the require path.

Owner

isaacs commented May 7, 2010

Fixed in 9baec09

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment