npm config set persists invalid values but silently ignores them at runtime
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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