添加新依赖项后,我在React Native应用程序的红色屏幕中收到错误消息"无法解析模块路径".我已经尝试按屏幕指示清除缓存.
(问题很简短,因为我自己回答)
我的英语有点生疏,我很抱歉。
当我在 iOS 模拟器上启动 react-native 项目时出现错误。
为了排除与我的代码的任何冲突,我开始了一个新项目
react-native init demo
react-native start
react-native run-ios --simulator="iPhone 6"
Run Code Online (Sandbox Code Playgroud)
现在是当我收到消息错误时
Loading dependency graph, done.
error: bundling failed: Error: Unable to resolve module `warnOnce` from `node_modules/react-native/Libraries/react-native/react-native-implementation.js`: warnOnce could not be found within the project.
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-* …Run Code Online (Sandbox Code Playgroud)