Home > database >  Error when trying to install react-twitter-embed
Error when trying to install react-twitter-embed

Time:11-06

I'm trying to install react-twitter-embed on my react app. I have tried deleting and reinstalling my node_modules folder and clearing my npm cache. I've tried upgrading my node and npm to the latest version as well.
Here's the error I'm getting:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: ant-design-pro@2.2.0
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"^17.0.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^15.0.0 || ^16.0.0" from react-twitter-embed@3.0.3
npm ERR! node_modules/react-twitter-embed
npm ERR!   react-twitter-embed@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Here's the list of current dependencies in my package.json

    "@ant-design/icons": "^4.7.0",
    "@antv/data-set": "^0.10.0",
    "@apollo/client": "^3.4.11",
    "@babel/runtime": "^7.2.0",
    "@ethersproject/abi": "^5.4.1",
    "@ethersproject/address": "^5.4.0",
    "@ethersproject/bignumber": "^5.4.0",
    "@ethersproject/bytes": "^5.4.0",
    "@ethersproject/constants": "^5.4.0",
    "@ethersproject/contracts": "^5.4.0",
    "@ethersproject/providers": "^5.4.1",
    "@ethersproject/solidity": "^5.4.0",
    "@ethersproject/units": "^5.4.0",
    "@material-ui/core": "^4.12.3",
    "@web3-react/core": "^6.1.9",
    "@web3-react/fortmatic-connector": "^6.1.6",
    "@web3-react/injected-connector": "^6.0.7",
    "@web3-react/ledger-connector": "^6.1.9",
    "@web3-react/network-connector": "^6.1.9",
    "@web3-react/portis-connector": "^6.1.9",
    "@web3-react/torus-connector": "^6.1.9",
    "@web3-react/trezor-connector": "^6.1.9",
    "@web3-react/walletconnect-connector": "^6.2.6",
    "@web3-react/walletlink-connector": "^6.2.6",
    "accounting-js": "^1.1.1",
    "antd": "^3.26.20",
    "apollo-boost": "^0.4.9",
    "axios": "^0.18.1",
    "bizcharts": "^3.4.2",
    "bizcharts-plugin-slider": "^2.1.1-beta.1",
    "bootstrap": "^5.0.2",
    "chalk": "^2.4.2",
    "classnames": "^2.2.6",
    "core-js": "^3.17.2",
    "crypto-js": "^4.1.1",
    "dayjs": "^1.10.7",
    "echarts": "^5.2.2",
    "echarts-for-react": "^3.0.1",
    "enquire-js": "^0.2.1",
    "graphql": "^15.5.3",
    "graphql-tag": "^2.12.5",
    "hash.js": "^1.1.5",
    "lodash": "^4.17.10",
    "lodash-decorators": "^6.0.0",
    "math.js": "^1.1.46",
    "memoize-one": "^5.0.0",
    "moment": "^2.22.2",
    "numeral": "^2.0.6",
    "nzh": "^1.0.3",
    "omit.js": "^1.0.0",
    "only-last-promise": "^1.0.0",
    "path-to-regexp": "^2.4.0",
    "prop-types": "^15.7.2",
    "qs": "^6.6.0",
    "rc-animate": "^2.4.4",
    "react": "^17.0.2",
    "react-apollo": "^3.1.5",
    "react-bootstrap": "^2.0.0-beta.4",
    "react-click-outside": "^3.0.1",
    "react-container-query": "^0.11.0",
    "react-copy-to-clipboard": "^5.0.1",
    "react-datepicker": "^4.2.1",
    "react-detect-click-outside": "^1.1.1",
    "react-device-detect": "^1.17.0",
    "react-document-title": "^2.0.3",
    "react-dom": "^17.0.2",
    "react-fittext": "^1.0.0",
    "react-media": "^1.8.0",
    "react-redux": "^7.2.3",
    "react-router-dom": "^4.3.1",
    "redux": "^4.0.5",
    "styled-components": "^5.3.3",
    "web3-eth": "^1.6.0",
    "web3-eth-contract": "^1.6.0",
    "web3-utils": "^1.6.0"
  },

CodePudding user response:

As the error states, you need to have react 15 or 16 installed. Your package.json currently has react 17 instead. Change it to:

    "react": "^16.0.0",

then re-run npm install.

PS: you will probably update some of the other dependencies as well then, e.g., "react-dom": "^17.0.2" probably won't work anymore.

The alternative is to write to the maintainers of the package you want and see when they think react 17 will be supported.

  • Related