undefined无法从App.js
解析模块@react-navigation/native
:在项目中找不到@react-navigation/native。
如果您确定模块存在,请尝试下列步骤:
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-*
- node_modules\react-native\Libraries\Utilities\HMRClient.js:307:41 in showCompileError
- node_modules\react-native\Libraries\Utilities\HMRClient.js:228:26 in client.on$argument_1
- node_modules\eventemitter3\index.js:181:39 in emit
- node_modules\metro\src\lib\bundle-modules\WebSocketHMRClient.js:80:20 in _ws.onmessage
- node_modules\event-target-shim\dist\event-target-shim.js:818:39 in EventTarget.prototype.dispatchEvent
- node_modules\react-native\Libraries\WebSocket\WebSocket.js:232:27 in _eventEmitter.addListener$argument_1
- node_modules\react-native\Libraries\vendor\emitter\EventEmitter.js:190:12 in emit
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:436:47 in __callFunction
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:111:26 in __guard$argument_0
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:384:10 in __guard
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:110:17 in __guard$argument_0
* [native code]:null in callFunctionReturnFlushedQueue
Unable to resolve "@react-navigation/native" from "App.js"
Failed building JavaScript bundle.
Unable to resolve "@react-navigation/native" from "App.js"
Failed building JavaScript bundle.
Unable to resolve "@react-navigation/native" from "App.js"
Failed building JavaScript bundle.
> Unable to resolve "@react-navigation/native" from "App.js"
Unable to resolve "@react-navigation/native" from "App.js"
Failed building JavaScript bundle.
Error: Can't find react-native in package.json dependencies
Error: Can't find react-native in package.json dependencies
请帮助我。电子邮件ID:网站名称gmail.com
8条答案
按热度按时间tquggr8v1#
如果使用expo:
同时运行:
6za6bjd02#
发生此错误的原因是您尚未安装react-navigation。
运行时间:
hgtggwj03#
最好的解决方案是删除您的node_modules和package-lock.json并尝试npm安装,它对我很有效
hfsqlsce4#
尝试将此行添加到metro.config.js
tkqqtvp15#
嗯,我已经通过重新安装/更新这些软件包解决了这个问题。
对...起作用
npm start -- --reset-cache
但执行以下操作确实成功:
删除
node_modules & package-lock.json从手机中删除应用程序
avwztpqn6#
此外,你必须重新启动你的应用程序,做npm运行...启动一个新的服务器,如果你正在使用expo。
nr9pn0ug7#
我一直在同一个问题上卡住了一整天,最后删除packagelock.json和节点模块文件夹与使用
尝试重置该高速缓存
在NPM启动之后
最后运行:npxReact-原生运行-安卓
现在所有的文件都将被重建,你的导航容器应该可以工作了
iibxawm48#
此错误是由于缓存过时造成的。若要修复此问题,请运行:npm start -c //如果您使用expo
如果不使用expo,请运行:npxReact-本机启动-重置-缓存