Search code examples
javascriptreactjsnpmreactstrap

Regarding Reactstrap installation


when I'm trying to install react strap using this command but not able to install the reactstrap.

npm install reactstrap --save

that time i'm getting this error

npm WARN ERESOLVE overriding peer dependency
npm WARN Found: react@17.0.1
npm WARN node_modules/react
npm WARN   peer react@"*" from @testing-library/react@11.2.2
npm WARN   node_modules/@testing-library/react
npm WARN     @testing-library/react@"^11.2.2" from the root project
npm WARN   4 more (react-dom, react-popper, the root project, reactstrap)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"0.14.x || ^15.0.0 || ^16.0.0" from react-popper@1.3.7
npm WARN node_modules/reactstrap/node_modules/react-popper
npm WARN   react-popper@"^1.3.6" from reactstrap@8.8.0
npm WARN   node_modules/reactstrap
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: react@17.0.1
npm ERR! node_modules/react
npm ERR!   peer react@"*" from @testing-library/react@11.2.2
npm ERR!   node_modules/@testing-library/react
npm ERR!     @testing-library/react@"^11.2.2" from the root project
npm ERR!   peer react@"17.0.1" from react-dom@17.0.1
npm ERR!   node_modules/react-dom
npm ERR!     peer react-dom@"*" from @testing-library/react@11.2.2
npm ERR!     node_modules/@testing-library/react
npm ERR!       @testing-library/react@"^11.2.2" from the root project
npm ERR!     react-dom@"^17.0.1" from the root project
npm ERR!     1 more (reactstrap)
npm ERR!   3 more (react-popper, the root project, reactstrap)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^0.14.0 || ^15.0.0 || ^16.0.0" from create-react-context@0.3.0
npm ERR! node_modules/reactstrap/node_modules/create-react-context
npm ERR!   create-react-context@"^0.3.0" from react-popper@1.3.7
npm ERR!   node_modules/reactstrap/node_modules/react-popper
npm ERR!     react-popper@"^1.3.6" from reactstrap@8.8.0
npm ERR!     node_modules/reactstrap
npm ERR!       reactstrap@"*" 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.
npm ERR!
npm ERR! See C:\Users\prajjkum\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\prajjkum\AppData\Local\npm-cache\_logs\2020-12-26T11_13_07_327Z-debug.log

So how to resolve this error please help me... I have tried to uninstall and then again install but it it not working anymore so i'm posted it here


Solution

  • The problem here definitely seems to be with npm 7. Unfortunately, I am not getting the error with your setup, but only the warnings and I don't know why.

    If the issue is indeed with npm, I can suggest two things :

    1. npm install --save reactstrap --legacy-peer-deps and
    2. npx -p npm@6 npm install.

    Before proceeding with any step, ensure that you delete node_modules and package-lock.json