-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@ngtools/webpack complainning about not an NgModule #3157
Comments
@princemaple can you paste your AotPlugin configuration, please? |
oops, I missed this is an angular-cli related. Without it (i.e. just using |
I had a very simple minimal AotPlugin config, something like new ngtools.AotPlugin({
tsConfigPath: '/var/build/tsconfig.json',
entryModule: '/var/build/src/app.module#AppModule'
}) |
Note I used absolute paths, because I saw some commits in this repo saying something about relative paths not working. I am pretty sure my path was valid. |
I see. In that case, I have no more to add. |
I have the same problem here. I also configured it like @princemaple. BTW: I have not defined any entry point. |
@marinho thanks for taking a look still! |
AotPlugin.prototype.getNgModuleMetadata = function (staticSymbol) {
var ngModules = this._reflector.annotations(staticSymbol).filter(function (s) {
return s instanceof core_1.NgModule;
});
if (ngModules.length === 0) {
throw new Error(staticSymbol.name + " is not an NgModule");
}
return ngModules[0];
}; Whereas {
filePath: '/Users/***skipped***/client/app/app.module.ts',
name: 'AppModule',
members: undefined
} ...and Seems like the annotations are not set correctly? The path is valid. |
@janwo did you try without ".ts" in When enabling AoT, it didn't pass because I had some imports with BTW, I still don't have my app successfully in AoT. I'm also learning in this topic at this very moment. |
@marinho Thanks for your response. Yes, its all without a suffix. Somehow it works now, I deleted my node_modules folder and installed all dependencies again. It's weird as I updated them before as well. |
I have the same problem, see #2667 |
Im also getting the same. If I build a new project using |
I have the problem with the AotPlugin for Webpack... |
It seems like |
Strangely, this error shows up on |
For me downgrading to |
@zakdances thanks for heads up. Will skip this update :) Previous dancing with this error is hard to forget. |
Downgrading to 2.0.12 didnt work for me. :( When I run |
|
Sorry, I meant to write 2.0.10. |
@zakdances downgrading all packages to 2.2.3 didn't work for me..:( Which packages did you downgraded to 2.2.3 exactly?? Thanks |
@DutchKevv make sure you downgrade router to 3.2.3 or so as well. |
Thanks Jess, but didn't get it to work.. Using these packages -> "@angular/common": "2.2.3", Probably just wait until Typescript and Angular are friends again on final releases.. But can't build production now :( |
@DutchKevv try to |
I think this issue is related to In https://github.com/angular/angular/blob/2.2.x/tools/@angular/tsc-wrapped/src/collector.ts#L254 , which collects metadata from case ts.SyntaxKind.ClassDeclaration:
const classDeclaration = <ts.ClassDeclaration>node;
if (classDeclaration.name) {
const className = classDeclaration.name.text;
if (node.flags & ts.NodeFlags.Export) { // this is false always!
if (classDeclaration.decorators) {
if (!metadata) metadata = {};
metadata[className] = classMetadataOf(classDeclaration);
}
}
} this code works only if |
I'm getting the same error using TypeScript 2.0.10, trying to link modules from 1 app into another. Both are generated using angular-cli version 1.0.0-beta.22. |
Yep same problem here with |
not working even with typescript 2.0.10, using @ngtools/webpack 1.1.9
reproduction repo, just update the package.json for ngtools and angular packages fixed, following updates from 45d5154 |
@tarlepp @antonybudianto Workaround: Specify the precise dependency versions in the package.json. |
@timosalm already did, it's breaking after @ngtools 1.1.6 |
My external modules only builds when: Angular: 2.2.3 I've tried several combinations.
|
@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:
|
Hello. 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": { |
@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 |
Hello. |
How is that done?
…On Tue., 10 Jan. 2017, 00:15 Ivan Kishkevich, ***@***.***> 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
<#3157 (comment)>,
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 |
Yeah, in the end these are peer dependencies. If you update one you gotta update all... |
@princemaple What do you mean? With 'angular2-router-loader' I can split my bundles. "scripts": { |
Yeap, this is now working with Typescript 2.1.4!
|
@ichent thanks for the information about the alternative! |
@princemaple You are welcome! |
I can also confirm that this is now working on the latest release versions..... Angular 2.4.2 |
Look for unwanted node_modules folders... I experienced the problem with "AppModule is not an NgModule" after trying to run "./node_modules/.bin/ngc" to build a translated version (the build failed and the app wasn't translated). |
I had one time forgot to add "typings"="index.d.ts" key to my package.json file. Once I did, I stopped getting Please add @NgModule error |
In case anyone stumbles across this, in my case it was misconfiguration. I was getting a
became
|
ng build and ng serve is not working for me .gives error ERROR in /home/pratiksha/migration//app/shared/user.service.spec.ts (7,3): Cannot find name 'beforeEach'. ERROR in /home/pratiksha/migration/app/shared/user.service.spec.ts (13,3): Cannot find name 'it'. ERROR in /home/pratiksha/migration/app/shared/user.service.spec.ts (14,5): Cannot find name 'expect'. ERROR in PopoverModule is not an NgModule ERROR in multi ./src/styles.css ./src/css/main.css ./src/css/font-awesome.min.css ./src/css/daterangepicker.css ./src/css/style.css ./src/css/style-bootstrap.css ./src/css/style-default.css ./src/css/style-material.css try all but not working for me . |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
using
@ngtools/webpack
1.1.7tried both
@angular/compiler-cli
2.1.x and 2.2.0The text was updated successfully, but these errors were encountered: