3

I am getting below error when installing particle.js in my React App:

code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: app-test@0.1.0
npm ERR! Found: react@17.0.1
npm ERR! node_modules/react
npm ERR!   react@"^17.0.1" from the root project   
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.0.0" from react-particles-js@3.4.1  
npm ERR! node_modules/react-particles-js
npm ERR!   react-particles-js@"*" 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\gydee\AppData\Local\npm-cache\eresolve-report.txt for a full report.
Ajeet Shah
  • 18,551
  • 8
  • 57
  • 87
gydee
  • 31
  • 1
  • 4
  • You need to downgrade your React version to version 16 because *react-particle-js* requires React V16 as its [peer-dependency](https://github.com/Wufe/react-particles-js/blob/84856a2ce47e41ace6dd6aaabf1189dfd830ca84/package.json#L41) – Ajeet Shah Mar 01 '21 at 10:31
  • Or you can try [--legacy-peer-deps](https://stackoverflow.com/q/66020820/2873538) option. – Ajeet Shah Mar 01 '21 at 10:37
  • Or you can use `react-tsparticles` [package](https://www.npmjs.com/package/react-tsparticles) (same core library, supports React 17) – Caelan Mar 01 '21 at 22:39
  • thank you I have installed react version 17 + react version 16.8.4 and it works – gydee Mar 03 '21 at 10:42

3 Answers3

3

it is a problem coming from version 7 of npm use:

npm install --legacy-peer-deps

fixed it for me

DoubleW
  • 31
  • 2
0
npm install react-particles-js --force
Slava Rozhnev
  • 9,510
  • 6
  • 23
  • 39
Abdul Kader
  • 11
  • 1
  • 4
-1

npm install react-particles-js --force or --legacy-peer-deps