1

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

  • Does https://stackoverflow.com/questions/64573177/unable-to-resolve-dependency-tree-error-when-installing-npm-packages help? – Damodar Hegde Dec 26 '20 at 11:30
  • Hi @DamodarHegde it didn't work for me i tried this as well.. – beginner_coder Dec 26 '20 at 14:34
  • What all did you try? 1) Share your package.json. 2) The output with the ways you have tried out. 3) The version of npm you are using – Damodar Hegde Dec 26 '20 at 16:49
  • ok @DamodarHegde 1) My package.json file is https://jsfiddle.net/9qz2v7u0/ 2) I tried by doing --force. like this npm install reactstrop --save --force, that time i got same error with this additional thing npm WARN using --force Recommended protections disabled. 3) Npm version is 7.3.0 – beginner_coder Dec 26 '20 at 17:22
  • 1
    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 – Damodar Hegde Dec 26 '20 at 18:17
  • @DamodarHegde it worked for me (npm install --save reactstrap --legacy-peer-deps) thank you so much :) – beginner_coder Dec 28 '20 at 08:52
  • Perfect! Happy to help :). I will add this to the answer so that people can later get easy references. You can then accept my answer, (upvote if you like ;) ) and close this question – Damodar Hegde Dec 28 '20 at 11:04

1 Answers1

1

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

Damodar Hegde
  • 386
  • 1
  • 8