How do I properly install @angular-devkit/build-angular with Angular 13?

3.3k views Asked by At

I have these dev dependencies in my Angular 13 project

  "devDependencies": {
    "@angular-devkit/build-angular": "~13.2.5",
    "@angular/cli": "~13.2.5",
    "@angular/compiler-cli": "~13.2.0",

When I run npm i, I get this error

npm ERR! Conflicting peer dependency: @angular/[email protected]
npm ERR! node_modules/@angular/compiler
npm ERR!   peer @angular/compiler@"13.2.7" from @angular/[email protected]
npm ERR!   node_modules/@angular/compiler-cli
npm ERR!     dev @angular/compiler-cli@"~13.2.0" from the root project
npm ERR!     peer @angular/compiler-cli@"^13.0.0" from @angular-devkit/[email protected]
npm ERR!     node_modules/@angular-devkit/build-angular
npm ERR!       dev @angular-devkit/build-angular@"~13.2.5" from the root project
npm ERR!     1 more (@ngtools/webpack)

I'm confused about how to resolve this. Does this mean I need to upgrade my compiler cli or downgrade my devkit? I'm also confused about how to figureout what the appropriate compatible versions are. How do I figure out the appropriate version of devkit to satisfy the "npm i" process?

1

There are 1 answers

2
CarlitosJan On

The @angular/compiler-cli version does not match your @angular/compiler version which is located under dependencies