问题描述:npm install 时报错
原因:
ERESOLVE unable to resolve dependency tree ---ERESOLVE 无法解析依赖关系树
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
修复上游依赖冲突,或重试
此命令带有 --force,或 --legacy-peer-deps
接受不正确(且可能损坏)的依赖项解析
根据报错信息可以得知是因为依赖冲突导致不能下载依赖包
查阅资料得知由于npm版本升级的原因造成的
npm v7之前的版本遇到依赖冲突会忽视依赖冲突,继续进行安装
npm v7版本开始不会自动进行忽略,需要用户手动输入命令
解决方法1 npm install --force 无视冲突,强制获取远端npm库资源 (覆盖之前)
解决方法2 npm install --legacy-peer-deps 忽视依赖冲突,继续安装(不覆盖之前)
success !