npm / npm/cli

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

Open
#8,890 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction commands through node bin/npm-cli.js and inspect how config set writes invalid values to ~/.npmrc versus how runtime validation omits them. Confirm the behavior for registry, fetch-retries, and fetch-timeout; done means an agreed validation or failure behavior prevents the confusing persisted-and-ignored state.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.