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

Created on 27 Apr 2017  Â·  16Comments  Â·  Source: angular/angular-cli

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

```ERROR in AppModule is not an NgModule
webpack: Failed to compile.


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

medium (days) medium investigation 1 (urgent) broken

Most helpful comment

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.

All 16 comments

TS 2.3 is not yet supported. Version 2.2.x is the latest currently supported version.

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.

Downgrading TypeScript from 2.2.2 to 2.3.1 did the trick here. Using Yarn.

Interestingly, the whole problem only surfaced on Travis (running Linux), not locally on OS X. Nuking node_modules and the Yarn cache had no effect on the issue in either environment.

This is very weird. Will investigate.

On a brand new project, with everything Angular 4.1.1, CLI at 1.0.1 and [email protected] I could not reproduce. I tried with npm and yarn.

Does someone have a repro I can follow to see this error?

Heya, can you try @angular/[email protected]? It should have TS 2.3.x support.

@filipesilva , I just tried with [email protected] and still getting the same error reported initially.

ERROR in AppModule is not an NgModule
webpack: Failed to compile.

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

Is there a repro that you can provide me with? It doesn't seem to happen with a brand new project so there must be something else triggering the error.

@filipesilva , sorry, private repo. But let me create a new project to test on my end.

Turns out @clydin has already fixed this in https://github.com/angular/angular-cli/pull/6115, but it will only be out on the next 1.1.x beta.

@filipesilva I tried testing on a new project created with the latest 1.1.0-beta.0 cli but got the following error after trying start server:

→ yarn start
path.js:1142
          cwd = process.cwd();
                        ^

Error: ENOENT: no such file or directory, uv_cwd
    at Error (native)
    at Object.resolve (path.js:1142:25)
    at Function.Module._resolveLookupPaths (module.js:390:17)
    at Function.Module._resolveFilename (module.js:460:31)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/yarn/bin/yarn.js:29:17)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)we

@filipesilva Could you please in the future align typescript version support of angular and angular-cli. The current situation with newest angular and newest angular-cli supporting two different typescript versions is confusing.

@teropa, @omargon, Also I tried to reproduce the issue. I'm using yarn. On windows, Debian and ubuntu it works for me without a glitch. Are you sure you have the latest typescript installed globally?

@mmc41 As it works in most setups, and it only fails for a few, how are we supposed to know? If it breaks in our own testing, we will not release. We don't have a crystal ball, that files issues for bug that are in the future ;)

In a mac and I was having the same error with [email protected], [email protected], and angular/[email protected]. 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.

@jancarloviray that worked for me - thanks

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sysmat picture sysmat  Â·  3Comments

jmurphzyo picture jmurphzyo  Â·  3Comments

delasteve picture delasteve  Â·  3Comments

brtnshrdr picture brtnshrdr  Â·  3Comments

daBishMan picture daBishMan  Â·  3Comments