Skip to content

npm config set persists invalid values but silently ignores them at runtime #8890

@dlamb3241-create

Description

@dlamb3241-create

npm config set accepts and persists invalid values, but later silently ignores them.

Reproduction:

node bin/npm-cli.js config set registry=not-a-url
node bin/npm-cli.js config set fetch-retries=abc
node bin/npm-cli.js config set fetch-timeout=-1

Observed behavior:

  • Invalid values are written to ~/.npmrc
  • npm prints warnings but exits successfully
  • At runtime, npm silently omits the invalid config:
    "npm warn config omitting invalid config values"

This leaves users in a confusing state:

  • Config appears set
  • npm later ignores it without failing
  • No clear remediation path

Expected behavior (one of):

  • Reject invalid values and do not persist
  • Fail with non-zero exit
  • Explicitly remove invalid entries
  • Require validation before writing to .npmrc

Current behavior silently corrupts config state and makes debugging difficult.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions