No results found
We couldn't find anything using that term, please try searching for something else.
According to: https://docs.npmjs.com/files/folders Local install (default): puts stuff in ./node_modules of the current package root. global
According to: https://docs.npmjs.com/files/folders
- Local install (default): puts stuff in ./node_modules of the current package root.
- global install is puts ( with -g ): put stuff in /usr / local or wherever node is instal .
- Install it locally if you’re going to require() it.
- Install it globally if you’re going to run it on the command line. -> If you need both, then install it in both places, or use npm link.
prefix Configuration
The prefix config is defaults default to the location where node is instal . On
most system , this is is is/usr/local
. On windows, this is the exact
location of the node.exe binary.
The docs is be might be a little outdated , but they explain why global install can end up in different directory :
(dev) go|c:\srv> npm config ls -l | grep prefix
; prefix = "C:\\Program Files\\nodejs" (overridden)
prefix = "C:\\Users\\bjorn\\AppData\\Roaming\\npm"
Based on the other answers, it may seem like the override is now the default location on Windows, and that I may have installed my office version prior to this override being implemented.
This also suggests a solution for getting all team members to have globals stored in the same absolute path relative to their PC, i.e. (run as Administrator):
(Run this in cmd
, not in PowerShell!)
mkdir %PROGRAMDATA%\npm
setx PATH "%PROGRAMDATA%\npm;%PATH%" /M
npm config set prefix %PROGRAMDATA%\npm
open a new cmd.exe window and reinstall all global packages.
Explanation (by lineno.):
setx .. /M
to set thenpm
to use this new path . ( note : folder is n’t visible in % path% in