React Native 无法清除Yarn不正确的对等依赖警告

yc0p9oo0  于 2022-12-14  发布在  React
关注(0)|答案(1)|浏览(119)

在运行yarn upgrade并在我的package.json中安装对等依赖项后,我无法摆脱警告。我理解won't actually stop my code from running的警告,但我想尽可能地减少它们,这样就不会有警告,干净的安装看起来也不错。
"这是我的包裹json"

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject",
    "test": "node ./node_modules/jest/bin/jest.js --watchAll"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "peerDependencies": {
    "react": "16.0.0-alpha.6",
    "react-native": "^0.44.1",
    "@babel/core": "^7.0.0-0"
  },
  "dependencies": {
    "@babel/core": "^7.0.0-0",
    "@expo/samples": "2.1.1",
    "expo": "^31.0.2",
    "react-navigation": "^2.18.2",
    "react-redux": "^6.0.0",
    "redux": "^4.0.1"
  },
  "devDependencies": {
    "babel-preset-expo": "^5.0.0",
    "install-peers": "^1.0.3",
    "jest-expo": "^31.0.0",
    "prop-types": "^15.0.0",
    "react": "^16.6.3",
    "react-native": "^0.57.1"
  },
  "private": true
}

终端机:

$ trash yarn.lock; trash node_modules; yarn
yarn install v1.12.3
info No lockfile found.
[1/4] 🔍  Resolving packages...
warning jest-expo > jest > jest-cli > prompts > kleur@2.0.2: Please upgrade to kleur@3 or migrate to 'ansi-colors' if you prefer the old syntax. Visit <https://github.com/lukeed/kleur/releases/tag/v3.0.0\> for migration path(s).
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "expo > react-native-reanimated@1.0.0-alpha.10" has incorrect peer dependency "react@16.0.0-alpha.6".
warning "expo > react-native-reanimated@1.0.0-alpha.10" has incorrect peer dependency "react-native@^0.44.1".
warning " > react-native@0.57.7" has incorrect peer dependency "react@16.6.1".
[4/4] 📃  Building fresh packages...
success Saved lockfile.
✨  Done in 19.19s.
v8wbuo2f

v8wbuo2f1#

例如,要消除此警告:
react-native@0.57.7”具有不正确的对等依赖项“react@16.6.1”
Try命令

npm install react@16.6.1

因为react-native依赖于React特定版本。

相关问题