无法使用 NPM 安装 React-Intl

问题描述 投票:0回答:2

我无法安装 react-intl。它一直在抛出错误

├──未满足的对等依赖 [email protected] └──[email protected]

npm WARN [email protected] 需要 react@^15.3.0 的对等体,但没有 已安装。
npm WARN [email protected] 需要一个对等的 反应@^0.14.0 || ^15.0.0-0 但没有安装。
npm 警告 [email protected] 需要 react@~15.2.0 的对等体,但没有 安装。

这是我的 package.json

"dependencies": {
     "baobab": "^1.1.2",
     "baobab-react": "^0.1.1",
     "d3": "^3.5.6",
     "fixed-data-table": "^0.4.6",
     "json2csv": "^2.12.0",
     "lodash": "^3.10.1",
     "moment": "^2.10.6",
     "numeral": "^1.5.3",
     "react": "^0.13.3",
     "react-hot-loader": "^1.3.0",
     "react-motion": "^0.2.7",
     "react-router": "^0.13.3",
     "react-style": "^0.5.5",
     "react-style-webpack-plugin": "^0.4.0",
     "scroller": "0.0.3",
     "superagent": "^1.3.0"   },
"devDependencies": {
     "babel": "^5.8.23",
     "babel-core": "^5.8.23",
     "babel-jest": "^5.3.0",
     "babel-loader": "^5.3.2",
     "esdoc": "^0.2.5",
     "file-loader": "^0.8.4",
     "jest-cli": "^0.5.8",
     "webpack": "^1.12.2",
     "webpack-dev-server": "^1.10.1" 
}
reactjs react-native react-intl
2个回答
2
投票

你的 React 版本是 ^0.13.3。这意味着您将仅获得 0.13.x,其中 x 是 React 正在发布的最大次要版本。查看react-intl的package.json,需要0.14.x或者15。

"peerDependencies": {
    "react": "^0.14.0 || ^15.0.0-0"
},

https://github.com/yahoo/react-intl/blob/master/package.json

这意味着你必须更新你的 package.json 到(注意反应变成 0.14.0:

"dependencies":{  
   "baobab":"^1.1.2",
   "baobab-react":"^0.1.1",
   "d3":"^3.5.6",
   "fixed-data-table":"^0.4.6",
   "json2csv":"^2.12.0",
   "lodash":"^3.10.1",
   "moment":"^2.10.6",
   "numeral":"^1.5.3",
   "react":"^0.14.0",
   "react-hot-loader":"^1.3.0",
   "react-motion":"^0.2.7",
   "react-router":"^0.13.3",
   "react-style":"^0.5.5",
   "react-style-webpack-plugin":"^0.4.0",
   "scroller":"0.0.3",
   "superagent":"^1.3.0"
},
"devDependencies":{  
   "babel":"^5.8.23",
   "babel-core":"^5.8.23",
   "babel-jest":"^5.3.0",
   "babel-loader":"^5.3.2",
   "esdoc":"^0.2.5",
   "file-loader":"^0.8.4",
   "jest-cli":"^0.5.8",
   "webpack":"^1.12.2",
   "webpack-dev-server":"^1.10.1"
}

0
投票

好吧,如果您的互联网连接不佳,它可能会发生。因为它发生在我身上。或者可以反应版本与 react-intl 不匹配

"react": "^18.2.0", "react-intl": "^5.25.1"

© www.soinside.com 2019 - 2024. All rights reserved.