简体   繁体   English

错误无法添加“反应导航”:运行纱线时未定义无效的包版本

[英]error Can't add "react-navigation": invalid package version undefined when run yarn

I am trying to install the project packages with the command "yarn " in MacBook Pro我正在尝试在 MacBook Pro 中使用命令“yarn”安装项目包

OS : macOS Mojave version 10.14.5操作系统:macOS Mojave 版本 10.14.5
"react-native": "0.60.5", “反应原生”:“0.60.5”,
"react": "16.8.6", “反应”:“16.8.6”,
"react-navigation": "3.11.0", “反应导航”:“3.11.0”,

yarn version 1.22.0纱线版本 1.22.0

Please find the attached images for the reference.请找到所附图片以供参考。

Screenshot 2020-02-26 at 4 10 40 PM截图 2020-02-26 at 4 10 40 PM

and I have another Dell laptop (Windows) there I could install the dependencies with the command "yarn"我有另一台戴尔笔记本电脑(Windows),我可以使用命令“yarn”安装依赖项

I need to install packages with the command "yarn" or "yarn install"我需要使用命令“yarn”或“yarn install”安装软件包

在此处输入图片说明

In the project root directory you can run this command to add dependencies:在项目根目录下,您可以运行此命令添加依赖项:

yarn add react react-native react-navigation

This will add the latest available versions or you can specify the latest version to the package.json dependencies entries:这将添加最新的可用版本,或者您可以将最新版本指定到package.json依赖项条目:

dependencies: {
    .....
    "react-navigation":"^4.0.0"
}

Delete any entry that is available in your package.json that starts with react-navigation and then run删除package.json中以 react-navigation 开头的任何可用条目,然后运行

yarn add react-navigation 

or take a valid react-navigation version for example:或者以一个有效的 react-navigation 版本为例:

"react-navigation": "^4.0.10",

place that inside your package.json under dependencies and run npm install将其放在您的package.json依赖项下并运行npm install

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 React 本机导航的纱线错误:“找不到模块:无法解析 'react-navigation'” - Yarn error with React native Navigation: "Module not found: Can't resolve 'react-navigation'" 无法使用 react-navigation 导航 - Can't navigate using react-navigation 已导入反应导航,但未定义 - React-navigation imported but undefined 安装后尝试设置时出现反应导航错误-元素类型无效 - React-navigation error when trying to set up after installing - Element type is invalid 即使遵循 react-navigation 文档,react-navigation 也无法在屏幕之间导航 - react-navigation can't navigate between screens even after following react-navigation docs react-navigation:按下Tab时如何运行我的功能? - react-navigation: How to run my function when a Tab is pressed? 我不断收到此错误(未找到模块:无法解析“react-navigation/native”)。 即使我安装了“react-navigation/native” - I keep getting this error (Module not found: Can't resolve 'react-navigation/native'). even though I have 'react-navigation/native' installed React-Navigation v5 无法导入底部选项卡 - React-Navigation v5 can't import bottom tab 找不到变量:使用react-navigation进行导航 - Can't find variable: Navigate with react-navigation 无法在TabNavigator中切换标签页(反应导航) - Can't switch Tabs in TabNavigator (react-navigation)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM