[BUG] Silent conflict when both prefer-offline=true and prefer-online=true are set, causing npm view to return stale cached data
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
When both prefer-offline=true and prefer-online=true are set in the .npmrc configuration, npm silently prioritizes prefer-offline. Commands that query the registry, such as npm view version, skip the network request entirely and return stale cached data. The CLI provides no warning or error message indicating that these mutually exclusive flags are conflicting or that prefer-online is being ignored.
Expected Behavior
npm should detect when mutually exclusive flags like prefer-offline and prefer-online are active simultaneously. It should either output a clear warning message to the console (e.g., WARN config: mutually exclusive flags prefer-offline and prefer-online detected) so the user is aware of the conflict, or ensure that explicitly setting prefer-online overrides the offline preference to force a network validation.
Steps To Reproduce
No response
Environment
No response
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 by reproducing the conflict with prefer-offline=true and prefer-online=true in .npmrc, then run npm view version and trace the CLI configuration and cache behavior. Determine how the conflicting settings are currently resolved. Done means the conflict is no longer silent and the resulting warning or precedence behavior is covered by verification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100