gpt4 book ai didi

react-native - 如何完全删除带有 pod 的 React Native 库?

转载 作者:行者123 更新时间:2023-12-04 15:22:14 38 4
gpt4 key购买 nike

我正在尝试从我们的 React Native 项目中删除 react-native-device-info(支持较小的 react-native-version-number)。

我已经采取了这些步骤:

  1. yarn 删除 react-native-device-info
  2. cd ios && pod install
  3. 清理构建并清除 watchman/packager 缓存
  4. 删除并重新创建 JS 包
  5. grep 查找整个项目目录中对 react-native-device-info 的任何 引用,包括节点模块(未找到)

但是,当我运行该应用程序时,我仍然遇到这些错误。我错过了什么?

[Thu Jul 23 2020 14:20:30.622]  ERROR    Error: @react-native-community/react-native-device-info: NativeModule.RNDeviceInfo is null. To fix this issue try these steps:
• For react-native <= 0.59: Run `react-native link react-native-device-info` in the project root.
• Rebuild and re-run the app.
• If you are using CocoaPods on iOS, run `pod install` in the `ios` directory and then rebuild and re-run the app. You may also need to re-open Xcode to get the new pods.
If none of these fix the issue, please open an issue on the Github repository: https://github.com/react-native-community/react-native-device-info
[Thu Jul 23 2020 14:20:30.623] ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
[Thu Jul 23 2020 14:20:31.746] ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)

enter image description here

最佳答案

在当前版本的 react-native 中,只需从 package.json 中删除依赖项并运行 pod install 即可。无需手动取消链接。

我们还在 package.json 中添加了一个 yarn postinstall 脚本,以始终运行 pod install:

"postinstall": "(cd ios && pod install)",

关于react-native - 如何完全删除带有 pod 的 React Native 库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63061724/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com