npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead. — how to fix
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
Quick fix: It's only a warning; your command still works. Upgrade npm to make it go away: npm install -g npm@latest (or install a current Node.js LTS, which bundles a newer npm). On Windows, if npm itself is too broken to upgrade, reinstall Node.js from the official installer.
What it means
For a few releases in 2022 the npm 8 CLI printed this warning whenever -g, --global or --local was used, recommending --location=global / --location=project instead. The npm team later reverted that deprecation, so current npm versions accept -g silently again.
The warning doesn't stop anything. If your install or command fails, look for the real npm ERR! lines further down.
Check your versions:
node -v
npm -v
Why you see it on every npm command (Windows)
On Windows the npm.cmd / npm shim that ships with Node.js runs an internal npm prefix -g to locate the global install folder. With the affected npm version, that internal call printed the warning, so it appears even for commands where you didn't type -g, like npm -v or npm start.
Fix 1: upgrade npm
npm install -g npm@latest
Then open a new terminal and check npm -v. On Windows, run the terminal as Administrator if npm is installed under C:\Program Files\nodejs.
Fix 2: upgrade Node.js
Every current Node.js LTS ships an npm that doesn't print this warning. Install it with the official installer, or with a version manager:
nvm install --lts
nvm use --lts
(nvm-windows uses the same commands.) This also avoids mismatches between an old Node and a very new npm.
Fix 3: npm is too broken to upgrade itself
If npm install -g npm@latest fails on Windows (permission or EPERM errors from files in use), close all terminals and editors, then:
- Uninstall Node.js from Apps & features.
- Delete leftover
C:\Program Files\nodejsif it still exists. - Install the current LTS from nodejs.org.
See also EPERM: operation not permitted for file-lock problems during global installs.
Should I change my scripts to --location=global?
No need. -g / --global work in all npm versions and are what the docs use. --location still exists as a config option, but switching scripts to it gains nothing.
Last updated 2026-12-05.