当我修补这样的依赖项时:
package.json
:
"dependencies":
"react-native-webview": "patch:react-native-webview@11.0.3#scripts/patches/react-native-webview+11.0.3.patch",
...
patches/react-native-webview+11.0.3.patch
:
diff --git a/apple/RNCWebView.m b/apple/RNCWebView.m
index ff9ff9e0..dfea91a8 100644
--- a/apple/RNCWebView.m
+++ b/apple/RNCWebView.m
@@ -194,12 +194,18 @@ - (void)dealloc
...
yarn
当我使用或在本地安装东西时一切正常yarn install
。补丁被应用,并且没有错误。
但是,当事情进入 CI 时,我收到如下错误:
**ERROR** Failed to apply patch for package react-native-webview at path
node_modules/react-native-webview
This error was caused because patch-package cannot apply the following patch file:
patches/react-native-webview+11.0.3.patch
Try removing node_modules and trying again. If that doesn't work, maybe there was
an accidental change made to the patch file? Try recreating it by manually
editing the appropriate files and running:
patch-package react-native-webview
If that doesn't work, then it's a bug in patch-package, so please submit a bug
report. Thanks!
https://github.com/ds300/patch-package/issues
如果我将补丁更改为使用a/node_modules/react-native-webview/apple/RNCWebView.m
. 然后我得到一个错误
➤ YN0001: │ Error: react-native-webview@patch:react-native-webview@npm%3A11.0.3#../../scripts/patches/react-native-webview+11.0.3.patch::version=11.0.3&hash=d13297&locator=proj-core%40workspace%3Alib%2Fproj-core: ENOENT: no such file or directory, lstat '/node_modules/react-native-webview/node_modules/react-native-webview/apple/RNCWebView.m'
at rn (/home/user/dev/proj-client/.yarn/releases/yarn-3.0.0.cjs:172:9625)
at kn (/home/user/dev/proj-client/.yarn/releases/yarn-3.0.0.cjs:172:9889)
at Qr.resolveFilename (/home/user/dev/proj-client/.yarn/releases/yarn-3.0.0.cjs:177:21594)
at Qr.resolveFilename (/home/user/dev/proj-client/.yarn/releases/yarn-3.0.0.cjs:177:21498)
at Qr.resolveFilename (/home/user/dev/proj-client/.yarn/releases/yarn-3.0.0.cjs:177:21498)
at Qr.lstatSync (/home/user/dev/proj-client/.yarn/releases/yarn-3.0.0.cjs:177:18712)
at Qr.lstatPromise (/home/user/dev/proj-client/.yarn/releases/yarn-3.0.0.cjs:177:18671)
at yt.lstatPromise (/home/user/dev/proj-client/.yarn/releases/yarn-3.0.0.cjs:177:34701)
at Zu (/home/user/dev/proj-client/.yarn/releases/yarn-3.0.0.cjs:578:7908)
at YB (/home/user/dev/proj-client/.yarn/releases/yarn-3.0.0.cjs:580:184)