需要不同版本的软件包

时间:2018-07-03 20:04:34

标签: javascript reactjs npm expo

我正在尝试将Expo,React和React-Native安装为项目的依赖项。 package.jason像这样:

"main": "node_modules/expo/AppEntry.js",
"private": true,
"dependencies": {
    "expo": "^28.0.0",
    "expo-three": "^3.0.0-alpha.2",
    "react-native": "0.48.3",
    "react": "15.0.0",
    "three": "^0.93.0"
}

问题是每个软件包都需要dep和peer dep!的特定版本。通过安装特定版本的软件包,其他软件包会引发错误。

├── expo@28.0.0
├── expo-three@3.0.0-alpha.2
├── UNMET PEER DEPENDENCY react@15.0.0
├── react-native@0.48.3
└── three@0.93.0

npm ERR! peer dep missing: react@> 15.0.0, required by react-native-gesture-handler@1.0.4
npm ERR! peer dep missing: react@^16.0, required by react-native-maps@0.21.0
npm ERR! peer dep missing: react@16.0.0-alpha.6, required by react-native-reanimated@1.0.0-alpha.3

我认为我可以安装最新版本并支持所有版本,但是没有用。

1 个答案:

答案 0 :(得分:0)

我使用package.json创建了一个仅包含您共享的软件包的项目,并使用npm版本6.1.0

安装了这些软件包

这是输出: enter image description here

这意味着您应该安装比package.json中更高的版本。

例如"react-native": "0.48.3", requires the react version 16,而您使用的是版本15。

如果您更新到"react": "16.3.0""react-native": "0.54.0",则可以解决大多数问题。但是,请确保您可以执行此更新,将React从15更新到16时会有一些警告。

相关问题