【问题标题】:npm install breaks react-native app created with exponpm install 破坏了使用 expo 创建的 react-native 应用程序
【发布时间】:2017-11-14 13:31:45
【问题描述】:

我目前正在使用本质上是使用 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 时遇到了节点依赖问题。

【问题讨论】:

    标签: react-native npm npm-install expo


    【解决方案1】:

    您使用的似乎是 npm 2,它不受支持,因为 create-react-native-app 在某种程度上取决于 npm 3+ 和 Yarn 的扁平化行为。

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

    【讨论】:

      猜你喜欢
      • 2020-03-11
      • 1970-01-01
      • 1970-01-01
      • 2020-12-06
      • 2019-07-02
      • 2017-12-09
      • 2019-02-23
      • 2022-10-07
      • 2019-11-16
      相关资源
      最近更新 更多