Home > Software engineering >  ERROR WHILE RUNNING ionic serve: [ng] Error: The Angular Compiler requires TypeScript >=4.4.2 and
ERROR WHILE RUNNING ionic serve: [ng] Error: The Angular Compiler requires TypeScript >=4.4.2 and

Time:12-10

I was trying to run the ionic serve command but I keep getting the error

[ng] Error: The Angular Compiler requires TypeScript >=4.4.2 and <4.5.0 but 4.5.2 was found instead.

When I tried downgrading the typescript using this command

npm install typescript@">=4.4.2 <4.5.0" --save-dev --save-exact

And Also running the npm i ; The ionic serve command gets stuck at the generating browser application bundle phase setup.

When I checked my angular version I got the following:

enter image description here

Angular CLI: 13.0.4
Node: 16.10.0
Package Manager: npm 8.1.4
OS: win32 x64

Angular: 13.0.3
... common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1300.4
@angular-devkit/build-angular   13.0.4
@angular-devkit/core            13.0.4
@angular-devkit/schematics      13.0.4
@angular/cli                    13.0.4
@schematics/angular             13.0.4
rxjs                            6.5.5
typescript                      4.5.2

Please, I need some help:

CodePudding user response:

Try this:

  • replace typescript 4.5.2 with typescript 4.4.4
  • save packages.json
  • run npm i again

CodePudding user response:

I had the same problem. This answer helped me. But it refers to a maximum of version 12 Angular. For version 13 Angular, I used this in the project:

npm i -D [email protected]

  • Related