Search code examples
angulartypescript

Error: Emit attempted before Angular Webpack plugin initialization. on npm start


Error: Emit attempted before Angular Webpack plugin initialization.

Error: Failed to initialize Angular compilation - The Angular Compiler requires TypeScript >=5.2.0 and <5.3.0 but 5.4.5 was found instead.

** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **

× Failed to compile.

What causes this error? I am using typescript of Version 5.4.5

Not able to compile, but it says compilation failed


Solution

  • The error message is clear enough: You can't use the installed Angular version with TypeScript 5.4.5, which is installed.

    You can upgrade Angular to the latest version, or downgrade TypeScript to 5.2.