React Navigation npm安装ERR新鲜的Expo Init @ react-navigation / native @ 3.1.4

时间:2019-02-08 13:44:37

标签: reactjs react-native native react-navigation expo

与Native Expo用户互动!

我在使用响应导航(空白和带选项卡)的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.

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

  • 清除NPM缓存

  • 尝试过的纱线

  • 再次安装expo cli

  • npm install-保存react-navigation ... react-native,native等

    npm install-保存反应导航 npm ERR!代码E404 npm ERR!找不到404:@ react-navigation / native @ 3.1.4

    • 注意:昨天我花了一整天的时间试图使新项目生效。我确实通过安装不同版本的react-native来通过它,并且无法复制...然后导致版本不匹配,并且应用程序无法加载:*

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

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

谢谢!

4 个答案:

答案 0 :(得分:2)

通过编辑根.npmrc文件确认我已解决: 注册表= https://registry.npmjs.org/

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

npm和yarn现在都可以在react-navigation上工作,而我得到的是404。 谢谢@Munishkin和@Atin Singh

答案 1 :(得分:0)

对于您的确切问题,我不清楚。因此,我假设您无法在EXPO中使用React-navigation。

在整个过程中尝试使用纱线,而不是npm。

当expo要求创建一个新项目,然后安装react-navigation use时,请使用yarn-

  

纱线添加反应导航

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

答案 2 :(得分:0)

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

答案 3 :(得分:0)

从博览会v31升级到v32时,我遇到了同样的问题。尝试了所有您所做的一切而没有运气。最后,使用npm install https://github.com/react-navigation/react-navigation-native从github安装为我解决了这个问题。然后,我分别安装了react-navigation软件包,然后安装了我项目的所有其他必需模块。