简体   繁体   English

无法使用npm安装react-navigation软件包

[英]Unable to install react-navigation package using npm

I'am building an app with expo. 我正在用Expo构建一个应用程序。 I want to use react-navigation to be able to navigate between screens. 我想使用react-navigation能够在屏幕之间导航。

But i am having trouble installing the package. 但是我在安装软件包时遇到了麻烦。 Actually I have this issue with every single package I am trying to install... 实际上,我要安装的每个软件包都存在此问题...

By running the installation script : 通过运行安装脚本:

npm install --save react-navigation npm install-保存反应导航

I have these warnings and I am not able to import the package in my project : 我收到这些警告,但无法将包导入到我的项目中:

 npm WARN expo-google-sign-in@2.0.0 requires a peer of react-native@^0.55.4 but none is installed. You must install peer dependencies yourself. npm WARN react-native-reanimated@1.0.0-alpha.11 requires a peer of react@16.0.0-alpha.6 but none is installed. You must install peer dependencies yourself. npm WARN react-native-reanimated@1.0.0-alpha.11 requires a peer of react-native@^0.44.1 but none is installed. You must install peer dependencies yourself. npm WARN url-loader@1.1.2 requires a peer of webpack@^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) 
The terminal error ouptu is : 终端错误ouptu是:

 While trying to resolve module `react-navigation` from file `/app/App.js`, the package `/app/node_modules/reactnavigation/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/app/node_modules/react-navigation/src/react-navigation.js`. Indeed, none of these files exist: [13:58:26] [13:58:26] * `/app/node_modules/react-navigation/src/react-navigation.js(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)` [13:58:26] * `/app/node_modules/react-navigation/src/react-navigation.js/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)` 

I have this issue every time a try to install a package. 每次尝试安装软件包时都会遇到此问题。 I didn't find any solution that works for me. 我没有找到适合我的解决方案。

If you still have that problem try react-navigation 2.0 instead. 如果仍然存在该问题,请尝试使用react-navigation 2.0。 Latest versions are not always the most stable ones 最新版本并不总是最稳定的版本

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM