Skip to content

[BUG] npm set does not respect -g flag in 7.20.0 onwards #3572

@billyjanitsch

Description

@billyjanitsch

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

npm set -g foo bar

In npm < 7.20.0, this writes foo=bar to the global npm config file (/usr/local/etc/npmrc).

In npm >= 7.20.0, the -g flag is not respected and foo=bar is written to the user npm config file (~/.npmrc).

Expected Behavior

The -g flag should result in a modification to the global config, not the user config.

Steps To Reproduce

  1. Run npm set -g foo bar.
  2. Run npm get.
  3. Note that foo has been set in the user config rather than the global config.

Environment

  • OS: macOS 10.15.7
  • Node: 14.17.3
  • npm: 7.20.0

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingRelease 7.xwork is associated with a specific npm 7 release

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions