Windows: Loading from the global folders #3462

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
5 participants

lamb commented Jun 17, 2012

Fix #3461
Windows do not have HOME environment variable, so that node will not search $HOME/.node_modules and $HOME/.node_libraries.On Windows, a similar environment variable is called USERPROFILE.

adammw commented Jun 19, 2012

Might be nicer to wrap each check in a (process.platform === 'win32') check so %HOME% doesn't get used accidentally on Windows, and $USERPROFILE doesn't get used accidentally on Linux (and etc.)

Owner

bnoordhuis commented Jul 3, 2012

@isaacs, @piscisaureus You guys should review this PR.

Owner

bnoordhuis commented Jul 3, 2012

Also, see the comments in #3461.

isaacs commented Jul 5, 2012

I'm still not seeing why this is necessary.

  1. It IS the same on both Unix and Windows. It checks the HOME environment variable on both. If you want this feature, set that environment variable. It also checks the NODE_PATH environment variable on both. If you want more control over it, then set that variable instead. (And it checks that one in a proper cross-platform way, separating with ; on Windows, and with : on unix.)
  2. If we could have gotten away with it then, we would have removed support for ~/.node_libraries in 0.4. The problem was that too many people relied on this mistaken API. No one on Windows currently relies on this default, since it was never supported, so this argument does not apply there.
  3. The only argument for making this easier on Windows is that there was not any way to do npm link on windows, making it a bit tricky to set up a module so that it could be loaded in multiple projects with require() without having to reinstall each time. However, in 0.8, npm link works on Windows, so that's not an argument.

I'm happy to hear other reasons why this is necessary that we may have overlooked, but "make it the same" just isn't convincing enough to justify changing the module system in such a way that encourages the use of an API that is a regrettable accident of history. I'm sorry.

isaacs closed this Jul 5, 2012

Member

piscisaureus commented Sep 4, 2012

@isaacs This is bugging me:

  • Either we deprecate and actually remove this feature on unix, or
  • I fix this problem.
Member

piscisaureus commented Sep 4, 2012

It IS the same on both Unix and Windows. It checks the HOME environment variable on both. If you want this feature, set that environment variable.

It's not functionally the same. The implementation is the same on windows and unix, which works sometimes on windows and always on unix.

@piscisaureus piscisaureus added a commit that referenced this pull request Oct 8, 2012

@piscisaureus piscisaureus windows: use USERPROFILE to get the user's home dir
Fixes #3461
Close #3462
Close #4093
5288ed7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment