问题描述
所以我在 stackblitz 上有一个项目,我想离线使用它以用于我自己的目的。作为参考,这里是我想要使用的链接 - https://stackblitz.com/edit/nvs-angular-search-dropdown-istnzp。因此,我尝试下载代码并计划使用 npm install
和 ng serve
运行它。但是我在运行 npm install
时遇到了很多错误,如下所示:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: angular@0.0.0
npm ERR! Found: @angular/compiler@12.0.3
npm ERR! node_modules/@angular/compiler
npm ERR! @angular/compiler@"^12.0.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler@"7.0.4" from @angular/compiler-cli@7.0.4
npm ERR! node_modules/@angular/compiler-cli
npm ERR! dev @angular/compiler-cli@"~7.0.0" 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\cnaag\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\cnaag\AppData\Local\npm-cache\_logs\2021-06-06T10_39_43_617Z-debug.log
这方面的任何帮助都会很棒!
解决方法
代替 NPM,在你的机器上安装 Yarn 并运行 yarn install