-2

I tried many ways to resolve this from cleaning cache to installing dependancies, like:-

npm install --legacy-peer-deps npm install @reduxjs/toolkit react-redux npm install @reduxjs/toolkit react-redux --legacy-peer-deps npm cache clean --force npm install --save --legacy-peer-deps

Then I tried to set legacy peer deps true using :- npm config set legacy-peer-deps true And then I installed legacy peer deps and tried again. npm install --save --legacy-peer-deps After this I installed packages like :- npm i @material-ui/core npm i @material-ui/icons and it worked.....

It might show some vulnerabilities but it would run fine.

I was trying to install material ui core and icon package but couldn't complete it because of issue with dependency tree.

  • 1
    Does this answer your question? [Unable to resolve dependency tree error when installing npm packages](https://stackoverflow.com/questions/64573177/unable-to-resolve-dependency-tree-error-when-installing-npm-packages) – miken32 Apr 07 '23 at 15:55

2 Answers2

-1

You can try different ways it may work but instead of installing packages again and again

  1. Set legacy peer deps as true :- npm config set legacy-peer-deps true
  2. Then install legacy peer deps :- npm install --save --legacy-peer-deps[using this]
  3. Then try installing your packages
General Grievance
  • 4,555
  • 31
  • 31
  • 45
  • Hi Bhavesh, since you found the right way to solve this issue, you can [accept it as the answer](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work/5235#5235), this will help others when they search for the similar issue in stackoverflow. :) – Bowman Zhu-MSFT Apr 21 '23 at 09:30
-1
npm config set legacy-peer-deps true
npm cache clean --force

If it is not working then delete your node modules file and again install it. Also check your node and npm version

General Grievance
  • 4,555
  • 31
  • 31
  • 45
jack
  • 43
  • 3
  • it might be package-versions that need to be installed based on your package.json file. It gives errors in the npm 7 version and cannot install Node.js modules. If you will downgrade npm version to 6, those problems will become warnings and the problem will be resolved. – jack Apr 04 '23 at 03:15