无法安装react-transition-group

时间:2017-07-17 15:49:52

标签: javascript node.js reactjs

尝试安装react-transition-group,但收到以下错误

npm install react-transition-group@1.x --save


npm ERR! peerinvalid The package react@15.6.1 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer react-bootstrap@0.31.0 wants react@^0.14.9 || >=15.3.0
npm ERR! peerinvalid Peer react-dom@15.6.1 wants react@^15.6.1
npm ERR! peerinvalid Peer react-fontawesome@1.6.1 wants react@>=0.12.0
npm ERR! peerinvalid Peer react-redux@5.0.5 wants react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0
npm ERR! peerinvalid Peer react-router@4.1.1 wants react@^15
npm ERR! peerinvalid Peer react-router-dom@4.1.1 wants react@^15
npm ERR! peerinvalid Peer react-simple-currency@1.0.15 wants react@^0.14.0
npm ERR! peerinvalid Peer react-transition-group@1.2.0 wants react@^15.0.0

packages.json中的当前依赖项是

 "dependencies": {
    "accounting": "0.4.1",
    "babel-runtime": "^6.20.0",
    "css-loader": "0.28.2",
    "history": "4.6.1",
    "immutable": "3.8.1",
    "jsonapi-serializer": "3.5.3",
    "numeral": "2.0.6",
    "prop-types": "15.5.10",
    "react": "^15.3.0",
    "react-bootstrap": "0.31.0",
    "react-dom": "^15.4.1",
    "react-fontawesome": "1.6.1",
    "react-redux": "5.0.5",
    "react-router": "4.1.1",
    "react-router-dom": "4.1.1",
    "redux": "3.6.0",
    "sprintf-js": "1.1.1",
    "style-loader": "0.18.1",
    "superagent": "3.5.2",
    "superagent-no-cache": "0.1.1",
    "zpad": "0.5.0"
  },

2 个答案:

答案 0 :(得分:2)

  1. 更新了npm npm install npm -g
  2. 清除缓存:npm cache clear
  3. 删除了node_modules rm -rf node_modules
  4. 重新安装了node_modules,npm install

答案 1 :(得分:-1)

只需执行以下命令: npm install react-transition-group

它将起作用。