首页 文章

npm install break使用expo创建的react-native app

提问于
浏览
2

我创建了几个不同的屏幕并完成了一些样式 . 但是,每当我在我的应用程序目录中运行任何 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 回答

  • 3

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

    React Native也最好支持Node 6及更高版本,因此我建议也升级Node .

相关问题