无法使用NPM安装React

无法使用NPM安装React

本文介绍了无法使用NPM安装React-Intl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法安装react-intl.它会不断抛出错误

I'm not able to install react-intl.It keeps throwing error

npm WARN [email protected]要求有一个react@^15.3.0的同位体,但没有一个 已安装.
npm WARN [email protected]需要一个对等体 react@^0.14.0 || ^ 15.0.0-0,但未安装.
npm警告 [email protected]要求有一个react@~15.2.0的同位体,但没有一个是 已安装.

npm WARN [email protected] requires a peer of react@^15.3.0 but none was installed.
npm WARN [email protected] requires a peer of react@^0.14.0 || ^15.0.0-0 but none was installed.
npm WARN [email protected] requires a peer of react@~15.2.0 but none was installed.

这是我的package.json

This is my 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"
}

推荐答案

您的反应版本仅为^ 0.13.3.这意味着您只会得到0.13.x,其中x是react正在发布的最大次要版本.查看react-intl的package.json,您需要0.14.x或15.

Your react version is just ^0.13.3. It means you will get only 0.13.x where x is the largest minor version react is publishing. Looking at the package.json of react-intl, you need 0.14.x or 15.

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

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

这意味着您必须将package.json更新为(请注意react变为0.14.0:

It means you have to update your package.json to (note that react becomes 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"
}

这篇关于无法使用NPM安装React-Intl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 00:05