angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

cli update 1.1.3 --> 1.2.1 causes "ERROR in AppModule is not an NgModule"

Open radoslavpetranov opened this issue 9 years ago • 4 comments

Bug Report or Feature Request (mark with an x)

- [ x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.2.1
node: 6.11.0
os: win32 x64
@angular/animations: 4.2.6
@angular/cdk: 2.0.0-beta.8
@angular/common: 4.2.6
@angular/compiler: 4.2.6
@angular/core: 4.2.6
@angular/flex-layout: 2.0.0-beta.8
@angular/forms: 4.2.6
@angular/http: 4.2.6
@angular/material: 2.0.0-beta.8
@angular/platform-browser: 4.2.6
@angular/platform-browser-dynamic: 4.2.6
@angular/router: 4.2.6
@angular/cli: 1.2.1
@angular/compiler-cli: 4.2.6

Repro steps.

My app is live in production and is working/compiling fine using the following dep versions:

@angular/cli: 1.1.3
node: 6.11.0
os: linux x64
@angular/animations: 4.2.4
@angular/common: 4.2.4
@angular/compiler: 4.2.4
@angular/core: 4.2.4
@angular/flex-layout: 2.0.0-beta.8
@angular/forms: 4.2.4
@angular/http: 4.2.4
@angular/material: error
@angular/platform-browser: 4.2.4
@angular/platform-browser-dynamic: 4.2.4
@angular/router: 4.2.4
@angular/cli: 1.1.3
@angular/compiler-cli: 4.2.4

I just updated angular-cli from 1.1.3 to latest (following the usual procedure described in the docs). The update also bumped @angular/material from beta.7 to beta.8 but I don't think that's related to the issue. There are 0 changes to the code except adding @angular/cdk: 2.0.0-beta.8 to package.json since it's apparently now required by @angular/material.

The log given by the failure.

ng serve log:

 69% building modules 970/972 modules 2 active ...i\node_modules\requires-port\i
 69% building modules 971/972 modules 1 active ...i\node_modules\requires-port\i
 69% building modules 971/973 modules 2 active ...\node_modules\querystringify\i
 69% building modules 971/974 modules 3 active ..._modules\core-js\modules\_to-i
 69% building modules 971/975 modules 4 active ...modules\_array-species-constru
 69% building modules 972/975 modules 3 active ...modules\_array-species-constru
 69% building modules 973/975 modules 2 active ...modules\_array-species-constru
 69% building modules 974/975 modules 1 active ..._modules\core-js\modules\_to-i
 69% building modules 975/976 modules 1 active F:\sonata2\s2ui\node_modules\ms\i
 69% building modules 975/977 modules 2 active ..._modules\core-js\modules\_is-a
 69% building modules 976/977 modules 1 active ..._modules\core-js\modules\_is-a
Hash: 0d946c55dd40bc78f947
Time: 34735ms
chunk    {0} main.bundle.js, main.bundle.js.map (main) 1.27 MB {4} [initial] [rendered]
chunk    {1} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 171 kB {5} [initial] [rendered]
chunk    {2} styles.bundle.js, styles.bundle.js.map (styles) 104 kB {5} [initial] [rendered]
chunk    {3} scripts.bundle.js, scripts.bundle.js.map (scripts) 21.5 kB {5} [initial] [rendered]
chunk    {4} vendor.bundle.js, vendor.bundle.js.map (vendor) 4.77 MB [initial] [rendered]
chunk    {5} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]

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

ng serve --aot log:

 38% building modules 235/242 modules 7 active ...i\node_modules\requires-port\i
 38% building modules 236/242 modules 6 active ...i\node_modules\requires-port\i
 38% building modules 237/242 modules 5 active ...i\node_modules\requires-port\i
 38% building modules 238/242 modules 4 active ...i\node_modules\requires-port\i
 38% building modules 239/242 modules 3 active ...i\node_modules\requires-port\i
 38% building modules 239/243 modules 4 active ...\node_modules\querystringify\i
 38% building modules 240/243 modules 3 active ...\node_modules\querystringify\i
 38% building modules 241/243 modules 2 active ...\node_modules\querystringify\i
 39% building modules 242/243 modules 1 active ...\node_modules\querystringify\i
 39% building modules 242/244 modules 2 active ..._modules\core-js\modules\_is-a
 39% building modules 243/244 modules 1 active ..._modules\core-js\modules\_is-a
 39% building modules 243/245 modules 2 active F:\sonata2\s2ui\node_modules\ms\i
 39% building modules 244/245 modules 1 active F:\sonata2\s2ui\node_modules\ms\i
Hash: 5c3e697d461d01f8748c
Time: 10563ms
chunk    {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 171 kB {5} [initial] [rendered]
chunk    {1} styles.bundle.js, styles.bundle.js.map (styles) 104 kB {5} [initial] [rendered]
chunk    {2} main.bundle.js, main.bundle.js.map (main) 2.13 kB {4} [initial] [rendered]
chunk    {3} scripts.bundle.js, scripts.bundle.js.map (scripts) 21.5 kB {5} [initial] [rendered]
chunk    {4} vendor.bundle.js, vendor.bundle.js.map (vendor) 1.15 MB [initial] [rendered]
chunk    {5} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]

ERROR in AppModule is not an NgModule

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in
 'F:\sonata2\s2ui\src'
 @ ./src/main.ts 3:0-74
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
webpack: Failed to compile.

Desired functionality.

To compile without errors

Mention any other details that might be useful.

radoslavpetranov avatar Jul 12 '17 23:07 radoslavpetranov

Ok wtf. I removed node_modules folder and ran npm install from scratch and everything compiles now.

radoslavpetranov avatar Jul 13 '17 08:07 radoslavpetranov

We have the same issue. First build always fails. Subsequent builds work fine.

sjswoboda avatar Jul 18 '17 17:07 sjswoboda

I solved the issue by updating Typescript version to "~2.3.0"

Nasruddin avatar Nov 23 '17 06:11 Nasruddin

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.