【问题标题】:Cannot get rid of yarn incorrect peer dependency warnings无法摆脱纱线不正确的对等依赖警告
【发布时间】:2018-12-08 19:30:02
【问题描述】:

运行 yarn upgrade 并在我的 package.json 中安装对等依赖项后,我无法摆脱警告。我了解警告won't actually stop my code from running,但我想尽量减少警告,以免出现警告,并且干净安装看起来不错。

这是我的 package.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.

【问题讨论】:

    标签: node.js react-native dependencies warnings yarnpkg


    【解决方案1】:

    例如,摆脱这个警告:

    react-native@0.57.7" 具有不正确的对等依赖关系 "react@16.6.1"

    试试命令

    npm install react@16.6.1
    

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

    【讨论】:

    • OP 询问的是 yarn。 NPM 在这里并没有真正的帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-31
    • 1970-01-01
    相关资源
    最近更新 更多