我们已经使用 react (16.9.0) 将我们的 react native 项目升级到了最新的 react native 版本 (v0.61.2),它在 android 上运行良好。当我们尝试在 ios think 上运行它时,我们得到消息:
warning: the transform cache was reset. Loading dependency graph, done. error: bundling failed: Error: Unable to resolve module `React` from `ios/Pods/React/Libraries/react-native/react-native.js`: React could not be found within the project or in these directories: node_modules
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules: rm -rf node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
我们遵循了升级指南,将所有依赖项更新到了最新版本并更新了 pod。我实际上不知道从哪里或如何开始调试它,因为这似乎来自 Pods 文件夹。
这是我们 Pods 文件夹的内容:
ls ios/Pods/
Adjust GoogleDataTransport
Crashlytics GoogleDataTransportCCTSupport
DoubleConversion GoogleUtilities
Fabric Headers
Firebase Local Podspecs
FirebaseABTesting Manifest.lock
FirebaseAnalytics Pods.xcodeproj
FirebaseAnalyticsInterop Protobuf
FirebaseCore Pushwoosh
FirebaseCoreDiagnostics PushwooshInboxUI
FirebaseCoreDiagnosticsInterop React
FirebaseDynamicLinks Target Support Files
FirebaseInstanceID boost-for-react-native
FirebaseRemoteConfig glog
Folly nanopb
GoogleAppMeasurement
在我们的 node_modules 文件夹中,我们有(还有更多其他包):
...
react
depd react-deep-force-update
des.js react-devtools-core
destroy react-is
detect-libc react-lifecycles-compat
detect-newline react-native
...
当然,我已经尝试了所有步骤,例如清除缓存、重置缓存、清除派生数据、清理和构建……我不知道从哪里开始寻找。