How to fix npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead in npm

npmINTERMEDIATELOWUpdated Dec 3, 2025· 168 views

This deprecation warning appeared briefly in npm 8.12.0 suggesting to use --location=global instead of -g. The deprecation was reversed in npm 8.12.1, but --location remains a valid modern alternative.

Quick fix

Fixes npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead

npm install -g npm@latest

npm --version
# Should be 8.12.1 or higher
  1. Update npm
  2. Use modern --location syntax (optional)
  3. Update CI/CD scripts (optional)
  4. Understand --location values
npm — error
npm install -g npm@latest
npm --version
# Should be 8.12.1 or higher
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead

What this error means

This warning indicated npm was transitioning from the traditional -g/--global flags to a new --location parameter. However, this deprecation was premature and was quickly reversed. In npm 8.12.0 (around Node.js 16.15.1), npm incorrectly deprecated --global. By npm 8.12.1, the deprecation was reverted—both syntaxes are valid. The --location parameter (introduced in npm 7) provides a unified way to specify configuration scope: global, user, or project. While not required, it's considered more explicit and modern.

Typical symptoms

  • Warning appears during npm commands with -g flag
  • Warning mentions deprecated --global or --local
  • npm operations still complete successfully
  • Only affects npm 8.12.0 specifically

Common causes

  1. Using npm version 8.12.0 specifically
  2. Brief period where flags were incorrectly deprecated
  3. Outdated npm configuration or scripts

How to fix "npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead"

1Update npm

The simplest fix is updating npm:

bash
npm install -g npm@latest

npm --version
# Should be 8.12.1 or higher

The warning should no longer appear.

2Use modern --location syntax (optional)

While -g still works, you can use the explicit syntax:

bash
# Traditional (still valid)
npm install -g typescript

# Modern alternative
npm install typescript --location=global

Both achieve the same result.

3Update CI/CD scripts (optional)

If you want to use the modern syntax in scripts:

Before:

bash
npm install -g webpack-cli
npm config set registry https://registry.npmjs.org/ -g

After:

bash
npm install webpack-cli --location=global
npm config set registry https://registry.npmjs.org/ --location=global
4Understand --location values

The --location flag accepts three values:

bash
# Global (system-wide)
npm config set key value --location=global

# User (~/.npmrc)
npm config set key value --location=user

# Project (./npmrc in project)
npm config set key value --location=project

Advanced notes

The deprecation was a mistake in npm 8.12.0. The npm team intended to transition to --location but implemented it prematurely. They quickly reversed it in 8.12.1.

Both syntaxes are fully supported:
- -g / --global: Traditional, widely used
- --location=global: Modern, more explicit

For scripts and documentation, either is acceptable. The -g flag is shorter and more familiar to most developers.

Frequently asked questions

What does "npm WARN config global `--global`, `--local` are deprecated. Use `--lo" mean?
This warning indicated npm was transitioning from the traditional -g/--global flags to a new --location parameter. However, this deprecation was premature and was quickly reversed. 1), npm incorrectly deprecated --global.
How do I fix "npm WARN config global `--global`, `--local` are deprecated. Use `--lo"?
This deprecation warning appeared briefly in npm 8.12.0 suggesting to use --location=global instead of -g. The deprecation was reversed in npm 8.12.1, but --location remains a valid modern alternative.
What causes "npm WARN config global `--global`, `--local` are deprecated. Use `--lo"?
Using npm version 8.12.0 specifically Brief period where flags were incorrectly deprecated Outdated npm configuration or scripts
Is the "npm WARN config global `--global`, `--local` are deprecated. Use `--lo" error serious?
It is a low-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading