@ngtools/webpack complainning about not an NgModule
using @ngtools/webpack 1.1.7
tried both @angular/compiler-cli 2.1.x and 2.2.0
import { NgModule, Component } from '@angular/core';
@Component({
selector: 'app',
template: '<h1>hello world</h1>',
styles: []
})
class AppComponent {}
@NgModule({
declarations: [AppComponent],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
Error: AppModule is not an NgModule
at AotPlugin.getNgModuleMetadata (/var/build/node_modules/@ngtools/webpack/src/plugin.js:297:19)
at AotPlugin._processNgModule (/var/build/node_modules/@ngtools/webpack/src/plugin.js:241:42)
at /var/build/node_modules/@ngtools/webpack/src/plugin.js:217:39
at process._tickCallback (internal/process/next_tick.js:103:7)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:394:7)
Done in 7.29s.
It works for me with @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @ngtools/[email protected] [email protected]
Yes, when I downgraded from Typescript 2.1.4 to 2.0.10 it works. I wish I could tell you why.
Regards,
Dwight
On Thu., 8 Dec. 2016 at 11:52 am, Avinash Tiwari [email protected] wrote:
It works for me with
@angular/[email protected]
@angular/[email protected]
@angular/[email protected]
@angular/[email protected]
@angular/[email protected]
@angular/[email protected]
@angular/[email protected]
@angular/[email protected]
@angular/[email protected]
@ngtools/[email protected]
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/3157#issuecomment-265711755, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbtmkSTOg-mbj3a4grQ1EkxKMH2PdlBks5rF-FTgaJpZM4KzvfR .
Fixed a lot of issues with path resolution and having your tsconfig in a different path than your webpack config. Closing this as fixed.
@hansl I'm experiencing this with an cli-built application that I upgraded from 1.0.0-beta.21 to 1.0.0-beta.22-1.
10% building modules 2/2 modules 0 active(node:39556) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: AppModule is not an NgModule
As far as I know the webpack config should be transparent to cli users, unless I'm missing something.
For me, fixing the versions in package.json fixed it:
- Angular 2.2.3
- Router on 3.2.3
- Typescript 2.0.10
I can confirm it breaks with TypeScript 2.1.4 and then works again after downgrading to 2.0.10.
@hansl please reopen this so someone can take a look, or at least point us to another issue where you're tracking this.
Fixed a lot of issues with path resolution and having your tsconfig in a different path than your webpack config. Closing this as fixed.
@hansl is this fixed in master?
As per @tinchou and @brugsel I am also unable to build unless I keep to the versions below
Angular 2.2.3 Router on 3.2.3 Typescript 2.0.10
My external modules only builds when:
Angular: 2.2.3 Router: 3.2.3 Typescript: 2.0.10 Angular-Cli: 1.0.0-beta.15
I've tried several combinations.
npm uninstall angular-cli -g
npm cache clean
npm install [email protected] -g
@hansl this is a legitimate issue and should be reopened, I also recently upgraded to Angular-Cli:1.0.0-beta.24 and encountered this breaking change, preventing work on a production site. Downgrading to beta.22 and related packages resolved the issue. It's possible that you mean this has been fixed post beta.24, if possible is there a workaround until the fix is released?
It builds (dev and prod) even though the error is shown. I use latest versions:
- angular 2.4.1
- typescript 2.1.4
- angular-cli 1.0.0-beta.24
Hello. I have this error today, after I updated angular to 2.4.1. Today I saw many errors, and "AppModule is not an NgModule", and "cannot read property codegen" and so on. Then I changed my package.json to previous state (worked state), and now I'm getinng an error "AppModule is not an NgModule". A current package.json is { angular: 2.2.3, router: 3.2.3, "@ngtools/webpack": "1.1.9", "typescript": "2.0.10", "webpack": "2.1.0-beta.25" }
and this is not working. Changing from 2.2.3 to 2.2.4 not solve this problem.
I had the "AppModule is not an NgModule" error plus various others. I've somehow now got Angular 2.4.1 working with Angular CLI 1.0.0-beta.24 and Typescript 2.0.10 !! :o)
(But not with 2.1.4, that produced the AppModule is not an NgModule". Given this I suspect I need to wait a while for Angular to work with Typescript 2.1.4.)
I followed the steps here for updating Angular-CLI
And here are my dependencies from package.json:
dependencies": {
"@angular/common": "2.4.1",
"@angular/compiler": "2.4.1",
"@angular/core": "2.4.1",
"@angular/forms": "2.4.1",
"@angular/http": "2.4.1",
"@angular/platform-browser": "2.4.1",
"@angular/platform-browser-dynamic": "2.4.1",
"@angular/platform-server": "2.4.1",
"@angular/router": "3.4.1",
"@angularclass/conventions-loader": "^1.0.2",
"@angularclass/hmr": "~1.2.2",
"@angularclass/hmr-loader": "~3.0.2",
"core-js": "^2.4.1",
"http-server": "^0.9.0",
"ie-shim": "^0.1.0",
"jasmine-core": "^2.5.2",
"reflect-metadata": "^0.1.9",
"rxjs": "~5.0.2",
"zone.js": "~0.7.4",
"ts-helpers": "^1.1.1"
},
"devDependencies": {
"@angular/compiler-cli": "2.4.1",
"@types/jasmine": "2.5.38",
"@types/node": "^6.0.42",
"angular-cli": "1.0.0-beta.24",
"codelyzer": "~2.0.0-beta.1",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "~4.0.13",
"ts-node": "1.2.1",
"tslint": "^4.0.2",
"typescript": "2.0.10"
}
@hansl I guess you closed this issue just because you assumed it should be somehow fixed, without checking it and asking affected users, right? Please reopen it and please let's find solution for this issue - it's pretty critical thing. Angular CLI is not usable at this moment because of this issue.
I need(ed?) TypeScript 2.1.x for Generator support. Typescript 2.2.3, 2.1.4, and 2.1.3-insiders.20161130 didn't work (I couldn't find 2.1.3). Dropping to 2.0.10 like suggested fix it.
I should note an older project had "angular-cli": "^1.0.0-beta.19-3", and "typescript": "v2.1.1" and that worked for both ng serve and ng test. Whatever, it works and only took 1 🍺.
Hello. Today I removed @ngtools/webpack from my project and now I'm using webpack for AoT. I'm happy.
How is that done?
On Tue., 10 Jan. 2017, 00:15 Ivan Kishkevich, [email protected] wrote:
Hello. Today I removed @ngtools/webpack from my project and now I'm using webpack for AoT. I'm happy.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/3157#issuecomment-271281411, or mute the thread https://github.com/notifications/unsubscribe-auth/ABRKNE4K2_0EGWHoo9fho4cB3LPyh1tGks5rQjLjgaJpZM4KzvfR .
Angular 2.4.2 just landed which fixed TS 2.1 support. I've successfully built 2.4.2 with typescript 2.1.4 and beta 24 of the cli.
@arciisine Which Angular dependency has to be updated to 2.4.2? common, core?
@sbley compiler-cli at least, preferable all.