首页 文章

无法使用NPM安装React-Intl

提问于
浏览
0

我无法安装react-intl.It一直在抛出错误

├──UNMETPEER DEPENDENCYreact@0.13.3└──reaction-intl@2.1.3npm WARN react-dom@15.3.0需要一个react @^15.3.0的同行,但没有安装 . npm WARN react-intl@2.1.3要求对方为react@^0.14.0 || ^ 15.0.0-0但没有安装 . npm WARN react-native@0.30.0需要一个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" 
}

1 回答

  • 2

    你的反应版本只是^ 0.13.3 . 这意味着你将只获得0.13.x,其中x是发布的最大次要版本 . 查看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"
    }
    

相关问题