Description
After updating patch-package
from version 6.1.2 to 6.2.0 in my project, running npm install --production
resulted in the error:
Error: Patch file found for package qqjs which is not present at node_modules/qqjs
If this package is a dev dependency, rename the patch file to
qqjs+0.3.10.dev.patch
Where qqjs
is indeed a transitive dev dependency. Renaming the patch file to .dev.patch
avoided the error, but led to the following warning when running npm install
without --production
:
Warning: patch-package detected a patch file version mismatch
Don't worry! This is probably fine. The patch was still applied
successfully. Here's the deets:
Patch file created for
qqjs@0.3.10.dev
applied to
qqjs@0.3.10
At path
node_modules/qqjs
This warning is just to give you a heads-up. There is a small chance of
breakage even though the patch was applied successfully. Make sure the package
still behaves like you expect (you wrote tests, right?) and then run
patch-package qqjs
to update the version in the patch file name and make this warning go away.
Following the printed advice and running patch-package qqjs
does not make any difference: the patch file is not modified, and the warning persists.
I gather / understand that the only "version mismatch" is the .dev
at the end of the version number ("0.3.10" vs. "0.3.10.dev"). Could the warning be avoided in this case? End users may get alarmed at _"There is a small chance of breakage."
I have a very simple pull request that "fixes" (works around?) this issue, by ignoring .dev
in the version comparison. Feel free to replace it with a more proper fix! Thank you.