Skip to content

patch package

Created: 2019-07-05 09:05:10 -0700 Modified: 2019-07-17 09:55:07 -0700

If you’ve ever felt the need to fork a git repository just to modify a couple of lines, then patch-package is probably perfect for your scenario!

Usage is easy enough by just following the instructions at the reference link. If you’re using Lerna, then you should install it at the root with the “-W” flag, e.g. “yarn add -W —dev postinstall-postinstall patch-package”.

When using this for scoped packages, you may need to do something like this:

npx patch-package @pixi/core

…if not, you may see this error message

Not creating patch file for package ‘pixi.js’

There don’t appear to be any changes.

ERROR Failed to apply patch for package @pixi/core

Section titled ERROR Failed to apply patch for package @pixi/core
**ERROR** Failed to apply patch for package @pixi/core
This happened because the patch file patches\pixi+core+5.0.4.patch could not be parsed.
If you just upgraded patch-package, you can try running:
cd patches\pixi+core+5.0.4.patc
patch -p1 -i h
npx patch-package @pixi/core
cd ../..
Otherwise, try manually creating the patch file again.
If the problem persists, please submit a bug report:
https://github.com/ds300/patch-package/issues/new?title=Patch+file+parse+error&body=%3CPlease+attach+the+patch+file+in+question%3E

Note: this only seems to be a problem on Windows.

I don’t know how to fix this, but I know how to work around it.

  • From the root…
    • Delete node_modules\pixi
    • Delete node_modulespixi.js
  • From the client folder…
    • yarn add @pixi/particles@5.0.4 @pixi/sprite-animated@5.0.4 pixi-particles@4.1.2 pixi.js@5.0.4

↑ Just make sure that the version numbers are correct

  • From the root…
    • yarn
  • This didn’t actually work the most recent time that I’d tried it.

Alternatively, you can just run the patch file manually from the root:

patch -p1 -i “patches/@pixi+core+5.0.4.patch”