1

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:

0

2 Answers 2

2

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]

Sign up to request clarification or add additional context in comments.

Comments

0

Try this:

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

3 Comments

Thanks for your answer but I have tried to replace it with 'typescript 4.4.4' and also run 'npm i'. But when I run the 'ionic serve' it gets stuck at the 'generating browser application bundle phase setup' stage and does not go beyond that stage
Can you also try to remove package-lock.json?
Also, has ionic serve worked before this în your app? This might also be caused by webpack choking on invalid css for exemple, so tracing your steps back to your latest working version should work as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.