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

module path installs puzzling global path #1946

Closed
Trott opened this issue Jun 11, 2015 · 2 comments
Closed

module path installs puzzling global path #1946

Trott opened this issue Jun 11, 2015 · 2 comments
Labels
module Issues and PRs related to the module subsystem.

Comments

@Trott
Copy link
Member

Trott commented Jun 11, 2015

For the sake of brevity, I'm going to assume Unix-like OS with iojs/node executables installed in /usr/local/bin but this issue is for every/any OS and any sane installation path.

The global path for modules includes /usr/local/lib/node (again, assuming the situation in the first paragraph). That just seems wrong. I can't tell if the correct thing is to include /usr/local/lib/node_modules instead or if the above path should just be removed. (Or maybe I'm misguided and there's a reason it's /usr/local/lib/node and should stay that way. But it sure looks like a bug...)

I'm inclined to remove the path unless there's a good reason to keep it. Adding /usr/local/lib/node_modules might be cool/expected, but that would arguably be a pretty big behavior change (suddenly, require() starts finding all your globally installed modules, which exposes the user to the possibility of dependency hell) that would probably warrant a lot of discussion. On the other hand, removing a useless path seems much lower stakes.

Am I right that it's a bug? Or is there some magic I don't know about?

@brendanashworth brendanashworth added the module Issues and PRs related to the module subsystem. label Jun 11, 2015
@targos
Copy link
Member

targos commented Jun 11, 2015

The doc says this folder is kept for historic reasons.

I am personally against this kind of magic global folders. It is far clearer to list dependencies locally in a package.json, even for private projects. I cannot think of any example where it is good to npm install -g a module for use with require.

@Trott
Copy link
Member Author

Trott commented Jun 11, 2015

Thanks! I should have searched the docs more than I did... Closing.

@Trott Trott closed this as completed Jun 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module Issues and PRs related to the module subsystem.
Projects
None yet
Development

No branches or pull requests

3 participants