Skip to content

[BUG] npm config set [key] [value] modifies values of other [key]s #2072

Closed
@ghost

Description

Current Behavior:

When using npm config set, npm sometimes modifies previously set values in the .npmrc not specified in the call, such as environment variable names.

Expected Behavior:

Running npm config set [key] [value] should only modify the value of [key] in the .npmrc.

Steps To Reproduce:

Observe the following commands in a Windows 10 command prompt with environment variables CUSTOM_ENV_ONE and CUSTOM_ENV_TWO. The .npmrc is empty to begin with.

>echo %CUSTOM_ENV_ONE%
1234

>echo %CUSTOM_ENV_TWO%
5678

>type %USERPROFILE%\.npmrc

>npm config set blah1 ${CUSTOM_ENV_ONE}

>type %USERPROFILE%\.npmrc
blah1=${CUSTOM_ENV_ONE}

>npm config set blah2 ${CUSTOM_ENV_TWO}

>type %USERPROFILE%\.npmrc
blah1=1234
blah2=${CUSTOM_ENV_TWO}

Notice how blah1 was changed from ${CUSTOM_ENV_ONE} to 1234 on the npm config set blah2 ${CUSTOM_ENV_TWO} call. This looks like a bug.

Environment:

  • OS: Windows 10 Pro 19042.572
  • Node: 14.5.0
  • npm: 6.14.8

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions