【问题标题】:NPM React peerDependencies errorNPM React peerDependencies 错误
【发布时间】:2016-01-13 16:19:40
【问题描述】:

我尝试安装几个与 React 相关的 npm 模块,但出现 peerDependencies 错误。这些版本对我来说似乎还可以:

npm ERR! peerinvalid The package react does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer react-autosuggest@3.3.1 wants react@^0.14.5
npm ERR! peerinvalid Peer react-bootstrap@0.28.2 wants react@>=0.14.0
npm ERR! peerinvalid Peer react-dom@0.14.6 wants react@^0.14.6
npm ERR! peerinvalid Peer react-router-bootstrap@0.20.1 wants react@>=0.14.0
npm ERR! peerinvalid Peer react-switch-button@1.1.1 wants react@^0.13.3

不 react@0.14.6 满足所有:

  • react@^0.14.5
  • react@>=0.14.0
  • react@^0.14.6
  • react@^0.13.3

我的 package.json 是:

    {
    "name": "Test",
    "version": "1.0.0",
    "description": "",
    "dependencies": {
        "babel-core": "^6.4.0",
        "babel-loader": "^6.2.1",
        "babel-plugin-transform-react-jsx": "^6.4.0",
        "babel-preset-es2015": "^6.3.13",
        "babel-preset-react": "^6.3.13",
        "babel-preset-stage-0": "^6.3.13",
        "history": "^1.17.0",
        "jquery": "^2.2.0",
        "lodash": "^4.0.0",
        "react": "^0.14.6",
        "react-autosuggest": "^3.3.1",
        "react-bootstrap": "^0.28.2",
        "react-dom": "^0.14.6",
        "react-router": "^2.0.0-rc2",
        "react-router-bootstrap": "^0.20.1",
        "react-switch-button": "^1.1.1",
        "webpack": "^1.12.11"
    }
    }

我错过了什么吗?

【问题讨论】:

  • 13.x14.x 不兼容(根据semver)。见规则here

标签: reactjs npm


【解决方案1】:

^Allows changes that do not modify the left-most non-zero digit in the [major, minor, patch] tuple.,所以react@^0.13.3 不匹配react@0.14.6

但它会匹配任何大于或等于0.13.30.13.x 版本。

【讨论】:

  • 我不明白的是,之前我已经成功安装了 react-switch-button@~1.1.1 和 react@~0.14.3…
猜你喜欢
  • 2016-12-28
  • 2017-08-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-01-04
相关资源
最近更新 更多