Is there an existing issue for this?
This issue exists in the latest npm version
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
Is there an existing issue for this?
This issue exists in the latest npm version
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.0andnpm@11.11.0, but fails innpm@11.12.0:Error:
This breaks NPM's git dependency preparation flow, because
pacotegenerates 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
npm@11.12.0npm install --prefer-offline=true --prefer-online=false --package-lock-only --ignore-scripts --no-audit --no-fund--prefer-online cannot be provided when using --prefer-offlineEnvironment