Is there an existing issue for this?
This issue exists in the latest npm version
This is not just a request to bump a dependency for a CVE
Current Behavior
When a patch fails and the install is run with --ignore-patch-failures, the package is installed unpatched and the lockfile records no patched entry for it — but package.json still declares the patchedDependencies entry. The two artifacts now disagree: a subsequent npm ci fails with the generic out-of-sync EUSAGE error (while a plain npm install re-attempts and fails with EPATCHFAILED).
Expected Behavior
Failing on a genuinely broken patch is reasonable. But the resulting state — a lockfile that is immediately npm ci-invalid against its own unchanged package.json — is surprising. A clearer message tying the out-of-sync state back to the skipped patch would help.
Steps To Reproduce
REPRO=/tmp/patch-ignore-fail && rm -rf "$REPRO" && mkdir -p "$REPRO" && cd "$REPRO"
cat > package.json <<'EOF'
{ "name": "ipf", "version": "1.0.0", "dependencies": { "is-positive": "3.1.0" } }
EOF
npm install --no-audit --no-fund
mkdir -p patches
cat > patches/[email protected] <<'EOF'
--- a/index.js
+++ b/index.js
@@ -1,3 +1,4 @@
NONEXISTENT
+x
fake
lines
EOF
node -e "const fs=require('fs');const p=require('./package.json'); \
p.patchedDependencies={'[email protected]':'patches/[email protected]'}; \
fs.writeFileSync('package.json',JSON.stringify(p,null,2))"
npm install --no-audit --no-fund --ignore-patch-failures # warns, installs unpatched
npm ci --no-audit --no-fund # => EUSAGE: not in sync
Observed
The --ignore-patch-failures install succeeds with a warning and writes a lockfile with no patched entry; npm ci then fails with EUSAGE (out of sync) against the unchanged package.json.
Expected
Either the artifacts stay consistent, or the npm ci failure message ties the out-of-sync state back to the skipped patch.
Environment
- npm: 12.0.0-pre.0
- Node.js: v24.15.0
- OS Name: Darwin 25.5.0 (macOS, arm64)
- Relevant config: none — reproduces with default configuration
Is there an existing issue for this?
This issue exists in the latest npm version
This is not just a request to bump a dependency for a CVE
Current Behavior
When a patch fails and the install is run with
--ignore-patch-failures, the package is installed unpatched and the lockfile records nopatchedentry for it — butpackage.jsonstill declares thepatchedDependenciesentry. The two artifacts now disagree: a subsequentnpm cifails with the generic out-of-syncEUSAGEerror (while a plainnpm installre-attempts and fails withEPATCHFAILED).Expected Behavior
Failing on a genuinely broken patch is reasonable. But the resulting state — a lockfile that is immediately
npm ci-invalid against its own unchangedpackage.json— is surprising. A clearer message tying the out-of-sync state back to the skipped patch would help.Steps To Reproduce
Observed
The
--ignore-patch-failuresinstall succeeds with a warning and writes a lockfile with nopatchedentry;npm cithen fails withEUSAGE(out of sync) against the unchangedpackage.json.Expected
Either the artifacts stay consistent, or the
npm cifailure message ties the out-of-sync state back to the skipped patch.Environment