React Navigation npm 安装 ERR fresh Expo Init @react-navigation/native@3.1.4

React Navigation npm install ERR fresh Expo Init @react-navigation/native@3.1.4

React Native Expo 用户!

我 运行 在使用 react-navigation 的 expo init 时出错(空白和带制表符):

npm ERR! 404  '@react-navigation/native@3.1.4' is not in the npm registry.

我已经使用 Expo 使用 React Native 进行开发几个月了,并且在学习和解决错误的过程中取得了巨大的成功!

我放假了,回来开始一个新项目,用react-navigation@^3.0.0碰壁了——我尝试了很多解决方案和无效。

我正在使用 expo 和 npm 开始一个新项目,选项卡和空白模板都有 react-navigation npm install 问题:

expo init
? Choose a template: expo-template-tabs
? Choose which workflow to use: managed
✔ Please enter a few initial configuration values.
  Read more: https://docs.expo.io/versions/latest/workflow/configuration · 100% completed
? Yarn v1.13.0 found. Use Yarn to install dependencies? No
[08:18:30] Extracting project files...
[08:18:31] Customizing project...
[08:18:31] Initialized a git repository.
[08:18:31] Installing dependencies...
npm WARN deprecated kleur@2.0.2: Please upgrade to kleur@3 or migrate to 'ansi-colors' if you prefer the old syntax. Visit <https://github.com/lukeed/kleur/releases/tag/v3.0.0\> for migration path(s).
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@react-navigation%2fnative - Not Found
npm ERR! 404
npm ERR! 404  '@react-navigation/native@3.1.4' is not in the npm registry.
npm ERR! 404 Your package name is not valid, because
npm ERR! 404  1. name can only contain URL-friendly characters
npm ERR! 404 It was specified as a dependency of 'react-navigation'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ddcjosiahl/.npm/_logs/2019-02-08T13_18_47_333Z-debug.log
[08:18:47] Process exited with non-zero code: 1
[08:18:47] Set EXPO_DEBUG=true in your env to view the stack trace.

我正在尝试没有运气的选项:

****RNGestureHandlerButton:**** enter image description here

为什么react-navigation@^3.0.0需要native@3.1.4,如何解决?

谢谢!

我不清楚你的确切问题是什么。因此,我假设您无法在 expo 中使用 React-navigation。

尝试在整个过程中使用 yarn 而不是 npm。

当 expo 要求创建一个新项目然后安装 react-navigation use-

时使用 yarn

yarn add react-navigation

我昨天使用了导航,它非常适合我。

这很奇怪,因为我刚刚尝试过,它很好地获取了 react-navigation 和所有依赖项。实际上,如果您直接在浏览器中加载 https://registry.npmjs.org/@react-navigation%2fnative url,您应该会看到相应的 JSON 模式。如果它给您 404,您可能需要对您的 DNS 解析器进行故障排除。

我在从 expo v31 升级到 v32 时遇到了同样的问题。尝试了所有您所做的事情,但没有运气。最后,从 github 和 npm install https://github.com/react-navigation/react-navigation-native 安装解决了我的问题。然后我分别安装了 react-navigation 包,然后为我的项目安装了所有其他必需的模块。

通过编辑 root .npmrc 文件来解决,确认我有: 注册表=https://registry.npmjs.org/

我的问题与“_auth=”有关。

npm 和 yarn 现在都可以使用 react-navigation 和我得到的 404。 谢谢@Munishkin 和@Atin Singh