简体   繁体   English

无法从“App.js”解析“@react-navigation/stack”

[英]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.

相关问题 React Native:“构建 JavaScript 包失败。 无法从“App.js”解析“@react-navigation/stack” - React native: “Failed building JavaScript bundle. Unable to resolve ”@react-navigation/stack“ from ”App.js“” 无法从“App.js”解析“react-navigation-stack” - Unable to resolve “react-navigation-stack” from “App.js” 无法从…/App.js 解析模块“react-navigation”:Haste 模块 map 中不存在模块“react-navigation” - Unable to resolve module 'react-navigation' from …/App.js: Module 'react-navigation' does not exist in the Haste module map 无法从“App.js”解析“react-navigation-drawer” - Unable to resolve “react-navigation-drawer” from “App.js” 无法从“node_modules\react-navigation-stack\lib\module\navigators\createStackNavigator.js”解析“react-navigation” - Unable to resolve “react-navigation” from “node_modules\react-navigation-stack\lib\module\navigators\createStackNavigator.js” 用于反应导航的Homescreen(App.js)结构 - Homescreen (App.js) structure for react-navigation 无法从 App.js 解析模块 - React Native - Unable to resolve module from App.js - React Native 无法解析 React-Navigation - Unable to resolve React-Navigation 使用 @react-navigation/stack 中的 createStackNavigator,无法渲染堆栈屏幕 - Using createStackNavigator from @react-navigation/stack, unable to render a stackscreen React Native 程序从“App.js”返回“无法解析”srcscreensComponentsScreenListScreen“ - React Native program returns “Unable to resolve ”srcscreensComponentsScreenListScreen“ from ”App.js"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM