Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • Read the docs but don't understand them. Could you explain in greater detail what you mean by ... Global installation means every project using the same node installation can require it. I'm running node on localhost, is the same installation just mean the machine or the machine and port number? Commented Dec 10, 2017 at 22:43
  • It has to do with the runtime environment. NPM is looking up files (.npmrc) and directories (node_modules) based on the installation path of Node/NPM itself and the HOME/USERPROFILE. There is nothing network related in global. Commented Dec 10, 2017 at 22:49
  • @DCR Neither Node or npm know or care about localhost or port numbers. If you do npm install foo for a project then only that project and nothing else can use that package (with require('foo')). If you do npm install -g foo then every project on your computer can use that package (again with require('foo')). Commented Dec 10, 2017 at 22:51
  • The docs in the first link you gave lack the -g in the command options. But if you scroll down or search for -g, there's a section about global options. Commented Apr 30, 2018 at 20:40