patch-package: Can't patch package
Just installed patch-package@6.4.6 and modified my package in node_modules and tried to run npx patch-package lottie-react-native but ended up with error.
npx patch-package lottie-react-native
patch-package 6.4.6
• Creating temporary folder
• Installing lottie-react-native@3.5.0 with npm
{
status: 1,
signal: null,
output: [ null, null, null ],
pid: 17928,
stdout: null,
stderr: null,
error: null
}
/Users/name/folder/appName/node_modules/patch-package/dist/makePatch.js:218
throw e;
^
{
status: 1,
signal: null,
output: [ null, null, null ],
pid: 17928,
stdout: null,
stderr: null,
error: null
}
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (1 by maintainers)
still get the same error at @v6.4.7 @ds300
patch-package 6.4.7 • Creating temporary folder • Installing ant-design-vue@2.1.6 with npm { status: 254, signal: null, output: [ null, null, null ], pid: 38727, stdout: null, stderr: null, error: null }
/Users/zhuguifeng/Documents/webank/init/node_modules/patch-package/dist/makePatch.js:218 throw e; ^ { status: 254, signal: null, output: [ null, null, null ], pid: 38727, stdout: null, stderr: null, error: null }
In case you find this issue:
Happy new year!
I ran into this issue trying to run
yarn patch-package <package_name>invscodeterminal. It failed, but for some reason it mac’s terminal it worked fine without any changes applied topatch-package. I checked and thenodeandyarnversions were same between both terminals.First, I installed
patch-packageto dependencies:npm install patch-packageThen, go to
node_modules/patch-package/dist/makePatch.js, find lines likespawnSafe_1.spawnSafeSync(npm, ["i", "--force"], {, and changestdio: "ignore",tostdio: "inherit",orstdio: "pipe",.In my case, ‘yarn’ does not work’, but finally I chaged yarn with npx. With above tip, npx works fine.
Just check if you are attempting to create file in your system path.Remember to use root identity for
npm install/npx patch-packagesudo suRan into this same issue but with yarn instead of NPM.
Had a yarn package I wanted to patch that had a separate dependency that was of a different version than specified in the yarn package. Yarn default behavior is to let you choose which version on to install upon yarn installation, but this was not happening in the makePatch.js file.
So per @Strate - we added stdio: “inherit” to the makePatch.js file when yarn is used (line 72) and then patch-package’d patch-package with this change. This then bypassed the version issue when patch-package was trying to run the yarn install function in makePatch.js and allowed us to make the patch file