angular-cli: Webpack Failed to Compile after Typescript 2.3.1 upgrade

Getting the following error message on ng start or ng test after upgrading Typescript to 2.3.1

webpack: Failed to compile.
[karma]: Error: AppModule is not an NgModule               
    at Compiler.compiler.plugin (.../node_modules/@angular/cli/plugins/karma-webpack-throw-error.js:10:23)

Versions.

→ ng --version
    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.0.1
node: 6.9.5
os: darwin x64
@angular/common: 4.1.0
@angular/compiler: 4.1.0
@angular/core: 4.1.0
@angular/forms: 4.1.0
@angular/http: 4.1.0
@angular/platform-browser: 4.1.0
@angular/platform-browser-dynamic: 4.1.0
@angular/router: 4.1.0
@angular/cli: 1.0.1
@angular/compiler-cli: 4.1.0

Repro steps.

Upgrade Typescript to 2.3.1

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

But Angular 4.1 clearly states that it supports 2.3 ! It is a quite confusing message that angular-cli is giving if it is not aligned with angular. Very annoying.

In a mac and I was having the same error with typescript@2.3.2, angular…@4.1.2, and angular/cli@1.0.3. Basically, all the latest versions…

What solved it was updating @angular/cli to 1.1.0-beta.1 in both local and global. Hope this helps.