在 React 中安装particle.js 时出现 NPM ERR

问题描述

在我的 React 应用程序中安装 particle.js 时出现以下错误

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.

解决方法

这是来自 npm use 的第 7 版的问题:

npm install --legacy-peer-deps

帮我修好了

,
npm install react-particles-js --force