我已经安装了所有的依赖,但我仍然得到下面的:使用Expo-CLI?
Failed building JavaScript bundle.
Unable to resolve module @react-navigation/native from /home/jonteyh/React_Native/projects/MealsToGo/App.js: @react-navigation/native could not be found within the project or in these directories:
../../../node_modules/@react-navigation
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
3 | import { ThemeProvider } from "styled-components/native";
4 | import { theme } from "./src/infrastructure/theme";
> 5 | import { NavigationContainer } from "@react-navigation/native";
| ^
6 | //import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
7 |
8 | import {
› Stopped server
我已经尝试删除.expo,node_modules,但仍然得到这个错误?
我该如何解决这个问题?
我试过上面的步骤了吗?
1条答案
按热度按时间olhwl3o21#
感谢Kevin M. Mansour帮助我解决这个问题!
首先,转到您的项目并删除
.expo
、node_modules
和yarn.lock
。删除这些文件后,安装依赖项:
然后运行以下命令:
之后,所有的错误都消失了!如果你的项目不是太大,请删除
yarn.lock
文件,如果你有一个大项目,它可能会引入一些错误!所以要小心删除yarn.lock
文件。