npm install break使用expo

时间:2017-06-12 23:31:20

标签: react-native npm npm-install expo

我目前正在处理使用expo创建应用程序时发布的默认存根代码(我已经创建了一些不同的屏幕并完成了一些样式)。但是,每当我在应用程序的目录中运行任何npm install命令时,该应用程序就会出现各种依赖性错误。

npm install redux --save redux react-redux

之后输出终端
npm WARN package.json app@0.0.0 No repository field.
npm WARN package.json app@0.0.0 No README data
npm WARN package.json app@0.0.0 No license field.
npm WARN unmet dependency ../app/node_modules/@expo/ex-navigation requires react-redux@'^4.4.5' but will load
npm WARN unmet dependency ../app/node_modules/react-redux,
npm WARN unmet dependency which is version 5.0.5
npm ERR! Darwin 16.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save" "redux" "react-redux"
npm ERR! node v4.2.2
npm ERR! npm  v2.15.12
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package react@16.0.0-alpha.6 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer react-native@0.44.0 wants react@16.0.0-alpha.6
npm ERR! peerinvalid Peer lottie-react-native@1.1.1 wants react@>=15.3.1
npm ERR! peerinvalid Peer react-native-branch@2.0.0-beta.3 wants react@>=15.4.0
npm ERR! peerinvalid Peer react-native-drawer-layout-polyfill@1.3.0 wants react@*
npm ERR! peerinvalid Peer react-native-fbads@4.1.0 wants react@*
npm ERR! peerinvalid Peer react-native-maps@0.14.0 wants react@>=15.4.0
npm ERR! peerinvalid Peer react-native-svg@5.1.8 wants react@16.0.0-alpha.6
npm ERR! peerinvalid Peer react-native-tab-view@0.0.61 wants react@*
npm ERR! peerinvalid Peer react-redux@5.0.5 wants react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0
npm ERR! peerinvalid Peer react-static-container@1.0.1 wants react@^0.13.0 || ^0.14.0 || ^15.0.0
npm ERR! peerinvalid Peer react-test-renderer@16.0.0-alpha.6 wants react@^16.0.0-alpha.6

npm ERR! Please include the following file with any support request:
npm ERR!     ../app/npm-debug.log

以下是ios模拟器中收到的输出:

Unable to resolve module `react-redux/lib/utils/storeShape` from `../app/node_modules/@expo/ex-navigation/src/ExNavigationProvider.js`: Module does not exist in the module map or in these directories:

      ../app/node_modules/react-redux/lib/utils
    ,   ../app/node_modules/react-redux/lib/utils

当我尝试删除并重新安装节点模块文件夹或重新安装npm时,我收到多个peerDependencies警告,然后是安装错误。我尝试在干净的项目中安装各种软件包,结果类似。在使用expo时,似乎其他人遇到了节点依赖性问题。

1 个答案:

答案 0 :(得分:3)

看起来你正在使用npm 2,因为create-react-native-app在某种程度上取决于npm 3+和Yarn的展平行为,所以不支持npm。

React Native也最好支持Node 6及更高版本,所以我也建议升级Node。