我经常收到类似下面的错误 ERESOLVE。你是怎么读的?
>npm audit fix
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: myapp@0.0.0
npm ERR! Found: @angular/compiler@12.1.0
npm ERR! node_modules/@angular/compiler
npm ERR! @angular/compiler@"12.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler@"12.1.1" from @angular/compiler-cli@12.1.1
npm ERR! node_modules/@angular/compiler-cli
npm ERR! dev @angular/compiler-cli@"^12.1.0" from the root project
npm ERR! peer @angular/compiler-cli@"^12.0.0 || ^12.1.0-next" from @angular-devkit/build-angular@12.1.0
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"12.1.0" from the root project
您如何理解它 - 哪个包取决于哪个包?我可以控制树的哪一端?顶部还是底部?
我是否将 @angular-devkit/build-angular 添加到我的应用程序中并且它需要但找不到 angular/compiler ?还是相反?
最佳答案
我可能是错的,但这是我读到的:
Which package depends on which?
您的应用直接依赖于:
@angular/compiler@"12.1.0"
@angular/compiler-cli@"^12.1.0"
@angular-devkit/build-angular@"12.1.0"
您的应用可传递地依赖于:
@angular/compiler@"12.1.1"
来自@angular/compiler-cli@12.1.1
<- 这是实际的@angular/compiler-cli
版本安装在你的 node_modules 中。@angular/compiler-cli@"^12.0.0 || ^12.1.0-next"
来自@angular-devkit/build-angular@12.1.0
<- 这是安装在您的 node_modules 中的实际@angular-devkit/build-angular
版本。
所以我读到的是存在冲突,因为您的应用直接依赖于 @angular/compiler@"12.1.0"
并传递于 @angular/compiler@"12.1。 1"
(来自 @angular/compiler-cli@12.1.1
)
您可能可以通过添加看起来像缺失插入符号的内容来解决此问题,即 @angular/compiler@"^12.1.0"
。
不相关 ^,我遇到了类似的问题,但所有版本都兼容。我删除了 package-lock.json
和 node_modules
并重新安装它们,它工作正常。
关于node.js - 你如何阅读 npm audit ERESOLVE 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68217049/