-
Notifications
You must be signed in to change notification settings - Fork 4.3k
[BUG] Exclusive configuration for --prefer-online and --prefer-offline breaks git dependency preparation flow #9133
Copy link
Copy link
Closed
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next steps
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
In the latest version of NPM (11.12.0), there appears to be a regression with config validation.
This command works in npm@11.10.0 and npm@11.11.0, but fails in npm@11.12.0:
npm install \
--prefer-offline=true \
--prefer-online=false \
--package-lock-only \
--ignore-scripts \
--no-audit \
--no-fund
Error:
Exit prior to config file resolving
cause
--prefer-online cannot be provided when using --prefer-offline
This breaks NPM's git dependency preparation flow, because pacote generates nested install commands with both --prefer-offline=<bool> and --prefer-online=<bool>. I noticed exclusivity was introduced here.
Expected Behavior
If a clean install finds a dependency that triggers the git dependency preparation flow, it should not throw an error from the generated config/flags in pacote.
Steps To Reproduce
- Using
npm@11.12.0 - Run
npm install --prefer-offline=true --prefer-online=false --package-lock-only --ignore-scripts --no-audit --no-fund - See error:
--prefer-online cannot be provided when using --prefer-offline
Environment
- npm: 11.12.0
- Node.js: 22.22.0
- OS Name: MacOS Tahoe 26.3.1
- System Model Name: Macbook Pro
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next steps