[英]Unable to resolve “@react-navigation/stack” from “App.js”
I'm trying react-native for the first time and trying to create a stack navigation, I'm getting the following error:我第一次尝试 react-native 并尝试创建堆栈导航,我收到以下错误:
Unable to resolve "@react-navigation/stack" from "App.js"
This is mu package.json file:这是 mu package.json 文件:
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/native": "^5.7.0",
"expo": "~38.0.8",
"expo-status-bar": "^1.0.2",
"react": "~16.11.0",
"react-dom": "~16.11.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz",
"react-native-gesture-handler": "^1.6.1",
"react-native-reanimated": "^1.9.0",
"react-native-safe-area-context": "^3.0.7",
"react-native-screens": "^2.9.0",
"react-native-web": "~0.11.7",
"react-navigation": "^4.4.0",
"react-navigation/stack@": "^5.7.0"
},
"devDependencies": {
"@babel/core": "^7.8.6",
"babel-preset-expo": "~8.1.0"
},
"private": true
}
I'm using expo cli to fire up my application.我正在使用 expo cli 来启动我的应用程序。
You have react-navigation/stack@
installed, and are trying to import @react-navigation/stack
.你已经安装了
react-navigation/stack@
,并且正在尝试导入@react-navigation/stack
。
Remove react-navigation/stack@
, since it's not the right import, and install @react-navigation/stack
with npm install --save @react-navigation/stack
.删除
react-navigation/stack@
,因为它不是正确的导入,并使用npm install --save @react-navigation/stack
@react-navigation/stack
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.