Search code examples
angularnpmtypescript-eslintangular-eslint

Migrate tslint to @angular-eslint/schematics: ERESOLVE unable to resolve dependency tree: @angular/[email protected]


I'm trying to migrate tslint to eslint in my angular 11 library using the official documentation here.

When I run the cmd ng add @angular-eslint/[email protected] I'm getting the following error:

✖ Package installation failed: npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: @angular/[email protected]
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/[email protected]
npm ERR!   node_modules/@angular-eslint/schematics/node_modules/@angular-eslint/template-parser
npm ERR!     peer @angular-eslint/template-parser@"*" from @angular-eslint/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
npm ERR!   node_modules/@angular-eslint/schematics
npm ERR!     dev @angular-eslint/schematics@"4.3.0" from the root project

Does anyone know how to solve it?


Solution

  • I found out here that you just need to run the following command:

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

    And then you can run:

    ng add @angular-eslint/[email protected]