1

我正在尝试使用此处的官方文档将 tslint 迁移到我的 angular 11 库中的 eslint 。

当我运行 cmd 时ng add @angular-eslint/schematics@4.3.0,出现以下错误:

✖ Package installation failed: npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: @angular/compiler@12.1.2
npm ERR! node_modules/@angular-eslint/schematics/node_modules/@angular/compiler
npm ERR!   peer @angular/compiler@">= 12.0.0 < 13.0.0" from @angular-eslint/template-parser@12.3.1
npm ERR!   node_modules/@angular-eslint/schematics/node_modules/@angular-eslint/template-parser
npm ERR!     peer @angular-eslint/template-parser@"*" from @angular-eslint/eslint-plugin-template@4.3.0
npm ERR!     node_modules/@angular-eslint/schematics/node_modules/@angular-eslint/eslint-plugin-template
npm ERR!       @angular-eslint/eslint-plugin-template@"4.3.0" from @angular-eslint/schematics@4.3.0
npm ERR!       node_modules/@angular-eslint/schematics
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler@">= 11.2.0 < 12.0.0" from @angular-eslint/eslint-plugin-template@4.3.0
npm ERR! node_modules/@angular-eslint/schematics/node_modules/@angular-eslint/eslint-plugin-template
npm ERR!   @angular-eslint/eslint-plugin-template@"4.3.0" from @angular-eslint/schematics@4.3.0
npm ERR!   node_modules/@angular-eslint/schematics
npm ERR!     dev @angular-eslint/schematics@"4.3.0" from the root project

有谁知道如何解决它?

4

1 回答 1

3

我在这里发现你只需要运行以下命令:

npm i -D @angular-eslint/template-parser@4

然后你可以运行:

ng add @angular-eslint/schematics@4.3.0
于 2021-07-20T20:47:00.847 回答