Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch react-native 0.59.9 failed #190

Open
caisd1998 opened this issue Nov 4, 2019 · 9 comments
Open

Patch react-native 0.59.9 failed #190

caisd1998 opened this issue Nov 4, 2019 · 9 comments

Comments

@caisd1998
Copy link

caisd1998 commented Nov 4, 2019

Looks like it's due to many new files generated under new directory "third-party" after I build my project.
I can fix it by excluding that directory:
yarn patch-package react-native --exclude third-party

Below is the error log if not exclude:
`yarn patch-package react-native
yarn run v1.16.0
$ /Users/samuel.cai/Documents/app/node_modules/.bin/patch-package react-native
patch-package 6.2.0
• Creating temporary folder
• Installing [email protected] with yarn
• Diffing your files with clean files

{
error: Error: spawnSync git ENOBUFS
at Object.spawnSync (internal/child_process.js:1041:20)
at Object.spawnSync (child_process.js:602:24)
at Function.spawnSync [as sync] (/Users/samuel.cai/Documents/app/node_modules/patch-package/node_modules/cross-spawn/index.js:26:23)
at Object.exports.spawnSafeSync (/Users/samuel.cai/Documents/app/node_modules/patch-package/dist/spawnSafe.js:10:32)
at git (/Users/samuel.cai/Documents/app/node_modules/patch-package/dist/makePatch.js:104:32)
at Object.makePatch (/Users/samuel.cai/Documents/app/node_modules/patch-package/dist/makePatch.js:135:26)
at /Users/samuel.cai/Documents/app/node_modules/patch-package/dist/index.js:48:25
at Array.forEach ()
at Object. (/Users/samuel.cai/Documents/app/node_modules/patch-package/dist/index.js:47:22)
at Module._compile (internal/modules/cjs/loader.js:774:30) {
errno: 'ENOBUFS',
code: 'ENOBUFS',
syscall: 'spawnSync git',
path: 'git',
spawnargs: [
'diff',
'--cached',
'--no-color',
'--ignore-space-at-eol',
'--no-ext-diff'
]
},
status: null,
signal: 'SIGTERM',
output: [
null,
<Buffer 64 69 66 66 20 2d 2d 67 69 74 20 61 2f 6e 6f 64 65 5f 6d 6f 64 75 6c 65 73 2f 72 65 61 63 74 2d 6e 61 74 69 76 65 2f 4c 69 62 72 61 72 69 65 73 2f 41 ... 1056718 more bytes>,

],
pid: 87610,
stdout: <Buffer 64 69 66 66 20 2d 2d 67 69 74 20 61 2f 6e 6f 64 65 5f 6d 6f 64 75 6c 65 73 2f 72 65 61 63 74 2d 6e 61 74 69 76 65 2f 4c 69 62 72 61 72 69 65 73 2f 41 ... 1056718 more bytes>,
stderr:
}

/Users/samuel.cai/Documents/app/node_modules/patch-package/dist/makePatch.js:181
throw e;
^
{
error: Error: spawnSync git ENOBUFS
at Object.spawnSync (internal/child_process.js:1041:20)
at Object.spawnSync (child_process.js:602:24)
at Function.spawnSync [as sync] (/Users/samuel.cai/Documents/app/node_modules/patch-package/node_modules/cross-spawn/index.js:26:23)
at Object.exports.spawnSafeSync (/Users/samuel.cai/Documents/app/node_modules/patch-package/dist/spawnSafe.js:10:32)
at git (/Users/samuel.cai/Documents/app/node_modules/patch-package/dist/makePatch.js:104:32)
at Object.makePatch (/Users/samuel.cai/Documents/app/node_modules/patch-package/dist/makePatch.js:135:26)
at /Users/samuel.cai/Documents/app/node_modules/patch-package/dist/index.js:48:25
at Array.forEach ()
at Object. (/Users/samuel.cai/Documents/app/node_modules/patch-package/dist/index.js:47:22)
at Module._compile (internal/modules/cjs/loader.js:774:30) {
errno: 'ENOBUFS',
code: 'ENOBUFS',
syscall: 'spawnSync git',
path: 'git',
spawnargs: [
'diff',
'--cached',
'--no-color',
'--ignore-space-at-eol',
'--no-ext-diff'
]
},
status: null,
signal: 'SIGTERM',
output: [
null,
<Buffer 64 69 66 66 20 2d 2d 67 69 74 20 61 2f 6e 6f 64 65 5f 6d 6f 64 75 6c 65 73 2f 72 65 61 63 74 2d 6e 61 74 69 76 65 2f 4c 69 62 72 61 72 69 65 73 2f 41 ... 1056718 more bytes>,

],
pid: 87610,
stdout: <Buffer 64 69 66 66 20 2d 2d 67 69 74 20 61 2f 6e 6f 64 65 5f 6d 6f 64 75 6c 65 73 2f 72 65 61 63 74 2d 6e 61 74 69 76 65 2f 4c 69 62 72 61 72 69 65 73 2f 41 ... 1056718 more bytes>,
stderr:
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

@laurent22
Copy link

Same issue here, even with the --include flag to only include the file I need. As it is patch-package is unusable to patch React Native because of this bug.

@caisd1998
Copy link
Author

Same issue here, even with the --include flag to only include the file I need. As it is patch-package is unusable to patch React Native because of this bug.

-- include works for me, but I don't want to use it because I need to patch two directories:

  1. I don't know how to use -- include for two directories.
  2. Even if I know, -- include doesn't support incremental change, for example, today I run -- include for one directory, tomorrow I run -- include for another directory, the generated path file only includes path for another directory. So I need to remember all directories I included before, and remember to include them once I need to path one more directory.

@shirakaba
Copy link

Just to add that --include works for me too (which I understand is no consolation if you're patching multiple directories). In case it helps, here's how I invoked patch-package to patch react-native/React/Base/RCTModuleMethod.mm:

node_modules/.bin/patch-package react-native --include React\\/Base\\/RCTModuleMethod\\.mm

@laurent22
Copy link

Just to add that --include works for me too

Somehow it doesn't work for me and I get the same error as above.

Eventually I just did diff -u oldFile.java newFile.java > newFile.patch and renamed it to whatever name patch-package expects.

It feels like there should be some optimisation when --include is specified, while now it's processing everything anyway and just filters the relevant files.

@shirakaba
Copy link

Eventually I just did diff -u oldFile.java newFile.java > newFile.patch and renamed it to whatever name patch-package expects.

Thanks for that shell snippet; I'll use that next time rather than having patch-package redownload the React Native package in its entirety.

@mosesoak
Copy link

mosesoak commented Apr 1, 2020

Same issue here (RN 0.57.8)

@brussee
Copy link

brussee commented Apr 8, 2020

Seems to be duplicate of #166

edit: Solution I'm using: #166 (comment)

edit2: #166 is fixed in v6.4.5
#166 (comment)
@caisd1998 Does this resolve your issue?

@xOIBrandon
Copy link

xOIBrandon commented Apr 8, 2021

I ran into this issue too using the npx version of patch-package. The fix was to install it globally so I was using the latest version. Thanks!

@pzxbc
Copy link

pzxbc commented Apr 20, 2022

Same issue here, even with the --include flag to only include the file I need. As it is patch-package is unusable to patch React Native because of this bug.

-- include works for me, but I don't want to use it because I need to patch two directories:

  1. I don't know how to use -- include for two directories.
  2. Even if I know, -- include doesn't support incremental change, for example, today I run -- include for one directory, tomorrow I run -- include for another directory, the generated path file only includes path for another directory. So I need to remember all directories I included before, and remember to include them once I need to path one more directory.

@caisd1998 try this command! I tries many times, and finally figure out the correct regex form

yarn patch-package react-native --include Libraries/fishhook/.*\|React/CxxBridge/.*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants