You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
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.
Activity
targos commentedon 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 -ga module for use with require.Trott commentedon Jun 11, 2015
Thanks! I should have searched the docs more than I did... Closing.