macOS Sierra
angular-cli: 1.0.0-beta.22
node: 7.2.0
os: darwin x64
$ ng new angular-sample-app --skip-git --skip-npm --style=scss --inline-template
$ cd angular-sample-app
$ yarn
$ git init
$ git add .
$ git commit -am "Initial commit"
This source to this module can be found here, and it's available on npmjs.
$ yarn add angular-sample-module
src/app/app.module.ts
import { SampleModule } from 'angular-sample-module';
SampleModule
to the imports
arraysrc/app/app.component.ts
<sampleComponent></sampleComponent>
to the template$ ng serve
** NG Live Development Server is running on http://localhost:4200. **
10% building modules 2/2 modules 0 active(node:18364) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: SampleModule is not an NgModule
(node:18364) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
20% building modules 84/84 modules 0 active
(node:17462) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: SampleModule is not an NgModule
(node:17462) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Downgrading to the previous version of angular-cli makes it work:
$ npm install --save-dev [email protected]
Link to a sample app showing the issue: https://github.com/beeman/angular-sample-app
Using ng new angular-sample-app
without my custom parameters on version 1.0.0-beta.22
and npm install
over yarn add
yields the same results.
Same issue on Windows10 x64
Yeah I can also confirm that updating angular-cli
to 1.0.0-beta.22-1
causes this problem. Any solutions ?
+1
same here
Been getting this in a few places. I was convinced it was my code but after trying to give it TS directly and seeing everyone complain here, I'm happy it's not just me. Probably spent a minimum of 10hrs here :) It doesn't seem to be very debuggable which is my issue. It just says: X is not an NgModule
and it's not even possible to see WHY or how it's even trying to load stuff. I don't even have the ability to pass in module-resolutions parameters to typescript to try and see what it's trying to load which makes this a bitch :(
Had same issue with this and it is related to incompatibility of Angular versions between 2.2.*
and
previous versions, so; update https://github.com/beeman/angular-sample-module/blob/master/package.json#L32-L33 to 2.2.3
which you have in your project and this will get compiled.
Summary is that 3rd party libs package.json
should have same version of Angular than your project.
I'm getting this error with 2.2.3 having already been set.
I tried with an example project that @beeman man provided here and updated package.json
in https://github.com/beeman/angular-sample-module and it got compiled.
spend a lot of time too some week ago on real world app and this solved the issue too.
Interesting. I just installed the latest version of Angular-Cli from Github, and was able to serve the included app. I changed core and common, and received the same error message. After replacing the entire contents with the beeman's sample, and updating core and common versions, I get "must be inside an angular-cli project to use build..." Changing a few parameters to make it more general in it's operation, and removing the main: and typings: declarations didn't help... Anyone have an idea of what's causing this? I'm using node 4.x.x. Thanks.
Hello, same issue with 1.0.0-beta.22
on macOS Sierra. And it works fine on 1.0.0-beta.21
Same thing happened to me 1.0.0-beta.22
It seems like [email protected] is causing the issue. Downgrading to 2.0.10 seems to make it pick up the metadata correctly.
@lurock I encountered this bug running on TypeScript version 2.0.10
:
~/workspace/beeman/angular-sample-app master
❯ grep version node_modules/typescript/package.json
"version": "2.0.10",
~/workspace/beeman/angular-sample-app master
❯ tsc -v
Version 2.0.10
Tried to use 2.0.10, to no avail...
Get Outlook for Androidhttps://aka.ms/ghei36
On Wed, Dec 7, 2016 at 4:50 PM -0600, "Bram Borggreve" <[email protected]notifications@github.com> wrote:
@lurockhttps://github.com/lurock I encountered this bug running on TypeScript version 2.0.10:
~/workspace/beeman/angular-sample-app master
? grep version node_modules/typescript/package.json
"version": "2.0.10",
~/workspace/beeman/angular-sample-app master
? tsc -v
Version 2.0.10
-
You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/angular/angular-cli/issues/3426#issuecomment-265599086, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJTUJDxsGt_RMrdJtadUyFhJogwsN-Osks5rFzhMgaJpZM4LFF9D.
Try building your project using "ng build --aot" and fix any build errors you have then go back to running "ng serve".
This gives me very similar output.
ng build --aot
10% building modules 2/2 modules 0 activeUnexpected value 'SampleModule' imported by the module 'AppModule'
Error: Unexpected value 'SampleModule' imported by the module 'AppModule'
at /Users/beeman/workspace/beeman/angular-sample-app/node_modules/@angular/compiler/bundles/compiler.umd.js:14675:33
at Array.forEach (native)
at CompileMetadataResolver._loadNgModuleMetadata (/Users/beeman/workspace/beeman/angular-sample-app/node_modules/@angular/compiler/bundles/compiler.umd.js:14660:51)
at CompileMetadataResolver.getUnloadedNgModuleMetadata (/Users/beeman/workspace/beeman/angular-sample-app/node_modules/@angular/compiler/bundles/compiler.umd.js:14636:23)
at addNgModule (/Users/beeman/workspace/beeman/angular-sample-app/node_modules/@angular/compiler/bundles/compiler.umd.js:12944:43)
at /Users/beeman/workspace/beeman/angular-sample-app/node_modules/@angular/compiler/bundles/compiler.umd.js:12957:16
at Array.forEach (native)
at _createNgModules (/Users/beeman/workspace/beeman/angular-sample-app/node_modules/@angular/compiler/bundles/compiler.umd.js:12956:28)
at analyzeNgModules (/Users/beeman/workspace/beeman/angular-sample-app/node_modules/@angular/compiler/bundles/compiler.umd.js:12700:16)
at analyzeAndValidateNgModules (/Users/beeman/workspace/beeman/angular-sample-app/node_modules/@angular/compiler/bundles/compiler.umd.js:12704:20)
at OfflineCompiler.compileModules (/Users/beeman/workspace/beeman/angular-sample-app/node_modules/@angular/compiler/bundles/compiler.umd.js:12775:20)
at CodeGenerator.codegen (/Users/beeman/workspace/beeman/angular-sample-app/node_modules/@angular/compiler-cli/src/codegen.js:58:30)
at /Users/beeman/workspace/beeman/angular-sample-app/node_modules/@ngtools/webpack/src/plugin.js:210:73
at process._tickCallback (internal/process/next_tick.js:103:7)
Hi everyone,
It has been taking me days to get a 'production' build, cause of all kind of error..
Some are typescript 2.1.1 related, some Angular 2.2.4 and some to the fact of AOT compiling.
Please also take in mind, when building a production build with --aot.. That export default
doesn't work!
https://github.com/angular/angular/issues/11402
You can use all the latest versions of everything, and than not use --aot, made it work for me.
Having the same issue after updating a project from Angular CLI 1.0.0-beta.19-3 to the latest (1.0.0-beta.22-1) on macOS Sierra. It appears that the following line is no longer returning anything in node_modules/@ngtools/webpack/src/plugin.js:330:
var ngModules = this._reflector.annotations(staticSymbol).filter(function (s) { return s instanceof core_1.NgModule; });
It looks like the instance of s
is not core_1.NgModule
.
If I change (monkeypatch) this to the following it works (though probably not the way it should be):
var ngModules = this._reflector.annotations(staticSymbol).filter(function (s) { return s.toString() === "@NgModule" });
Same thing here : https://github.com/yuyang041060120/ng2-validation/issues/28
Downgrading to 1.0.0-beta.21 fix the issue
The same issue. I am trying to start the sample app (full tour of heroes like here: https://embed.plnkr.co/?show=preview) with angular-cli 1.0.0-beta.22-1. When I remove usage of package angular-in-memory-web-api, the application not stuck in building.
"dependencies": {
"@angular/common": "2.2.3",
"@angular/compiler": "2.2.3",
"@angular/core": "2.2.3",
"@angular/forms": "2.2.3",
"@angular/http": "2.2.3",
"@angular/platform-browser": "2.2.3",
"@angular/platform-browser-dynamic": "2.2.3",
"@angular/router": "3.2.3",
"angular-in-memory-web-api": "0.1.16",
"core-js": "^2.4.1",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23"
}
Yep, just got bit by this after upgrading typescript to 2.1.4, had to revert back to 2.0.1, which is a bummer, because 2.1.4 has async/await support for es5
Also need this.
Isn't this exactly the kind of thing Angular CLI is supposed to help with, making sure that all of the versions being installed fit with each other? Seems like a big fail atm.
Just a sec ago switched Ubuntu to Win10 and made a ng serve
on same source. To my surprise this dragon jumped out of the bushes to bite my arse. On Ubuntu 16.10 it works like a charm. What is more, I have not noticed anyone here from any Linux distro (or no one managed to state it clear enough). So probably it is somehow platform dependent. How? don't know... :P
My setup is pretty much ToH based. Running on:
node: 7.2.1
ng: 2.2.3
ts: 2.1.4
ng-cli: 1.0.0-beta.22-1
@filipesilva or @hansl - is this something to do with angular-cli or with each of the projects themselves? Two example external deps which are giving this error for me are:
Would be nice to get your insight to if this is possible to fix in the next version as it's quite painful at the moment :)
I'm running in Ubuntu 16.04 and recurved the same error. I followed the
suggestion above and use typescript 2.0.10 for now. It's a good work around.
That being said, I'm also using Apollo client although I fail to see how
that is relevant.
On Mon, Dec 12, 2016, 7:16 AM Dominic Watson notifications@github.com
wrote:
@filipesilva https://github.com/filipesilva or @hansl
https://github.com/hansl - is this something to do with angular-cli or
with each of the projects themselves? Two example external deps which are
giving this error for me are:
Would be nice to get your insight to if this is possible to fix in the next
version as it's quite painful at the moment :)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/angular/angular-cli/issues/3426#issuecomment-266456577,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABq9MsqmBykpUW2GIb1_PfrN-4TIFnZhks5rHWU3gaJpZM4LFF9D
.
ok my bad... sorry for confusion... double checked the versions... Ubuntu was running on outdated typescript 2.0.10
not 2.1.4
but Win had fresh 2.1.4
. Now they are in sync and both fail in exact same manner...
Is angular core team supporting this project, because they should. It seems like angular-cli is having a hard time keeping up, shame because it's a great tool.
@vangorra This is something to do with the thirdparty library. They are not statically analyzable; basically they don't publish metadata.json
files which we need to understand their modules or components.
We're working on showing at least a warning and not failing the compilation when that happens.
ng serve
itself blocks because of https://github.com/webpack/webpack/issues/3464, which will be fixed before webpack RC1.
This is a dupe of another issue here that we use for tracking. I'll close this one when I find it (it's somewhere in my inbox).
I have the same issue as many others in here,but I found a quick workaround until this bug gets fixed - if you have a smaller app like I do,:
It's a pain in the *, so hopefully this will be fixed soon.
Cheers
+1
Have the same issue. Temporarily workaround that works for me is to downgrade typescript to 2.0.10.
I'm creating third party libraries that expose NgModules.
I simple build publish to npm and import the modules
I can confirm that downgrade to 1.0.0-beta.21 fix the issue
In my project I have used typescript 2.0.10 all the way long, so "downgrade" to that version is not the solution.
Ok, so just tested downgrading the ng cli to two different versions, with no luck, Any ideas?
I got mine to work by changing "angular-cli"
to "1.0.0-beta.15"
.
Was having different errors but appears to be building and serving now.
edit: My deps:
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"angular-cli": "1.0.0-beta.15",
"body-parser": "1.15.2",
"cookie-parser": "^1.4.3",
"core-js": "2.4.1",
"immutable": "^3.8.1",
"jsonwebtoken": "7.1.9",
"lodash": "4.17.2",
"moment": "^2.15.2",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "1.1.1",
"zone.js": "^0.6.23"
},
"devDependencies": {
"@types/jasmine": "^2.2.30",
"ava": "^0.17.0",
"codelyzer": "~0.0.26",
"jasmine-core": "2.4.1",
"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.5",
"supertest": "^2.0.1",
"ts-node": "1.2.1",
"typescript": "2.0.2",
"webpack": "^2.1.0-beta.22"
}
@asBrettisay, this worked for me. I was getting this error with ng2-flex-layout. Downgrading from [email protected] to [email protected] did the trick!
Just ran into this on a fresh project. "angular-cli": "1.0.0-beta.22-1"
10% building modules 2/2 modules 0 activeError: AppModule is not an NgModule
Downgrading back to "angular-cli": "1.0.0-beta.20-4"
fixed the issue for me.
try beta 24. The issue has disappeared for me
The same error. angular-cli: beta.24. angular: 2.4.1
With angular-cli beta.24 and typescript 2.1.4 I got the same error, but when downgraded only the typescript to version 2.0.10 the error was gone.
Any updates on this issue? can anyone clarify if the Issue is related to ng-cli or the third party module?
i'm on:
"angular-cli": "1.0.0-beta.24",
"@angular/compiler-cli": "^2.3.1",
"typescript": "^2.0.10",
"@angular/common": "^2.3.1",
the dependencies i have that angular-cli complains about are
https://github.com/Gbuomprisco/ng2-material-select
https://github.com/yuyang041060120/ng2-validation
Thanksss
(been added to the thread by @mhmo91)
Guys, those using TypeScript 2.1 please note that this is currently not supported because there are issues with TypeScript 2.1 and Angular itself, not just the CLI.
Those still having the issue with TypeScript 2.0 (ideally the default TypeScript and Angular packages that come with Angular CLI beta.24), can you please share a repository containing a simple Angular CLI generated project that has this issue?
Thanks a lot.
here's the rep.
thanksss
@mhmo91 That looks like a library problem
https://github.com/Gbuomprisco/ng2-material-select/pull/34
@Meligy Thankkk uuu, i believe it's up to the owner of the module to look the problem up.
Although i must raise a concern to everyone, This module along with others was working fine with previous builds of ng-cli, and now i'm worried that with every update some modules will just stop working, the whole idea behind the new ng2 design patterns is to embrace external modules n components... now this is just a nightmare with each new ng-cli version as some might just stop working!!!
With angular-cli version 1.0.0-beta.24 I'm still seeing an error: ERROR in SampleModule is not an NgModule
in the terminal window and my browser console, but at least the app runs, which is an improvement already 👍🏻 .
@hansl is this something that will be fixed in angular-cli or do 3rd-party modules need to update something to prevent this error from happening?
I was able to get my app working after fixing previously harmless typescript errors. After fixing my ts errors I still get "X is not an NgModule" but the app still runs.
angular-cli 1.0.0-beta.24 and angular 2.4.1.
When I use the 'default' keyword to export my module (export default class TheformModule {} )
"ng build --aot" or "ng build"
WARNING in ./src/$$_gendir/app/app.module.ngfactory.ts
609:37 export 'TheformModule' (imported as 'import26') was not found in '../../app/theform/theform.module'
WARNING in ./src/$$_gendir/app/app.module.ngfactory.ts
696:23 export 'TheformModule' (imported as 'import26') was not found in '../../app/theform/theform.module'
ERROR in default is not an NgModule
And Without the 'default' keyword
"ng build" :
ERROR in default is not an NgModule
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 getting 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 2.2.3 to 2.2.4 not solve this problem.
@hansl can you link the other issue you mentioned is tracking this problem?
Hi guys, I also met this issue, while my SampleModule
is literally irrelevant to the HerosModule
(see below).
I have code like below within routing module:
ex:
loadChildren: 'wrong_path/app/heros/heros.module#HerosModule'
after remove the wrong_path
above, everything just fine again.
A little bit more information.
angular 2.2.4
With "@ngtools/webpack": "1.2.1", typescript 2.0.10
I'm getting "ERROR in Cannot read property 'codeGen' of undefined"
With "@ngtools/webpack": "1.1.6", typescript 2.0.10
I'm getting "Error: IndexModule?sync=true is not an NgModule"
With "@ngtools/webpack": "1.1.9", typescript 2.0.10
I'm getting "Error: AppModule is not an NgModule"
angular 2.3.1
With "@ngtools/webpack": "1.1.9", typescript 2.0.10
I'm getting "TypeError: ngCompiler.ReflectorHost is not a constructor"
With "@ngtools/webpack": "1.1.6", typescript 2.0.10
I'm getting "TypeError: ngCompiler.ReflectorHost is not a constructor"
What error do you like? )))
One moment. A building not for production is ok, only aot-compilation is ok, but a final building with aot for production is not ok.
People are seeing this with my lib - ng2-redux - as well. I have reproduced it with CLI beta.24:
Relevant dependencies from package.json:
"@angular/common": "^2.3.1",
"@angular/compiler": "^2.3.1",
"@angular/core": "^2.3.1",
"@angular/forms": "^2.3.1",
"@angular/http": "^2.3.1",
"@angular/platform-browser": "^2.3.1",
"@angular/platform-browser-dynamic": "^2.3.1",
"@angular/router": "^3.3.1",
"ng2-redux": "^5.0.0-beta.0",
// ...
"typescript": "~2.0.3"
@hansl I saw your comment above re: 3rd-party libs needing to publish ng module meta data. However we are publishing it:
(that's a screenshot of my lib, as installed in a CLI-generated project's node_modules
folder).
Where can I get more info on how to publish an ngmodule correctly?
Here's a repo that reproduces the issue: https://github.com/SethDavenport/redux-cli-test
Ok figured it out, at least in our case. We publish the .module.metadata.json
in our lib
folder (the transpiled output of ngc
). However the CLI is trying to import stuff from src
. Presumably for tree-shaking reasons.
I don't love having to include generated code mixed up in my source tree TBH. But if
I have to I have to :)
Same issue. angular-cli 1.0.0-beta24 / typescript 2.1.4 is failing.
"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/router": "^3.4.1",
"core-js": "^2.4.1",
"rxjs": "^5.0.1",
"ts-helpers": "^1.1.1",
"zone.js": "^0.7.2"
},
"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.1.4"
}
I just want to say that @angular/compiler-cli
is NOT compatible with TS 2.1. The CLI itself is compatible and will work fine with TS 2.1, but since we use @angular/compiler-cli
it won't work.
Refer to https://github.com/angular/angular/pull/13294 for more information. Closing this as nothing needs to be done by Angular CLI.
@hansl I'm amazed to see the story closed for this reason as it's full of people having the same issue, also using supported versions of typescript.
If third party modules need upgrading could you please share some information on what needs to be done? Or a direction where to look? I'm happy to write some tutorial on how to make this error go away as it's in all of my current projects but I have no clue what the actual issue is.
Thanks for considering.
@beeman there was a lot of reports of different issues here. It's extremely hard to follow and I'll close more of those.
For your original issue; https://unpkg.com/[email protected]/
shows that you're missing .metadata.json
and use an old version. You're also using typings
, which is not recommended anymore and been replaced by @types/
. Follow this guide for AOT: https://angular.io/docs/ts/latest/cookbook/aot-compiler.html (basically run ngc
instead of tsc
to compile your files, with some more options to skip ngfactory generation).
Here's a full guide on how to make Angular2 component library: https://medium.com/@cyrilletuzi/how-to-build-and-publish-an-angular-module-7ad19c0b4464
Cheers!
Thanks a lot for your detailed reply @hansl, I appreciate it.
I'll update my components according to the library and post my updated (working) module here as a reference for future visitors.
Thanks for your work on angular-cli!
Big thanks @hansl for your answer.
1) I use @types instaed of typings.
2) I use ngc instead of tsc.
Here is my package.json
{
"name": "",
"version": "1.9.56",
"dependencies": {
"@angular/common": "2.2.4",
"@angular/compiler": "2.2.4",
"@angular/compiler-cli": "2.2.4",
"@angular/core": "2.2.4",
"@angular/forms": "2.2.4",
"@angular/http": "2.2.4",
"@angular/platform-browser": "2.2.4",
"@angular/platform-browser-dynamic": "2.2.4",
"@angular/platform-server": "2.2.4",
"@angular/router": "3.2.4",
"core-js": "^2.4.1",
"intl": "^1.1.0",
"lodash": "4.17.2",
"reflect-metadata": "^0.1.2",
"rxjs": "5.0.0-beta.12",
"zone.js": "^0.7.2"
},
"devDependencies": {
"@ngtools/webpack": "1.1.9",
"@types/lodash": "4.14.42",
"@types/requirejs": "^2.1.28",
"angular2-router-loader": "^0.3.3",
"angular2-template-loader": "^0.6.0",
"awesome-typescript-loader": "^2.2.4",
"compression-webpack-plugin": "^0.3.1",
"css-loader": "^0.26.1",
"extract-text-webpack-plugin": "^2.0.0-beta.4",
"file-loader": "^0.9.0",
"html-minify-loader": "^1.1.0",
"raw-loader": "^0.5.1",
"rimraf": "^2.5.4",
"style-loader": "^0.13.1",
"typescript": "2.0.10",
"webpack": "2.1.0-beta.25"
},
"scripts": {
"prepublish": "yarn run build",
"build": "yarn run clean && yarn webpack",
"build:jit": "yarn run clean && yarn webpack -- --env.production",
"build:production": "yarn run clean && yarn run compiler:aot && yarn webpack -- --env.aot --env.production",
"compiler:aot": "ngc -p client-code/src/tsconfig-aot.json",
"clean": "rimraf client-code/dist/* client-code/src/aot-compiled"
},
"engines": {
"node": ">=6.1.0"
}
}
I try to change versions, but it doesn't work. I get different errors. This happened some times ago after updating.
yarn run build - ok
yarn compiler:aot - ok
yarn build:jit - ok
yarn build:production - not ok.
So, or with @ngtools/webpack problem, or with angular2-router-loader (angular2-router-loader works without aot)
I have the same issue with this setup.
"dependencies": {
"@angular/common": "^2.3.1",
"@angular/compiler": "^2.3.1",
"@angular/core": "^2.3.1",
"@angular/forms": "^2.3.1",
"@angular/http": "^2.3.1",
"@angular/material": "^2.0.0-beta.1",
"@angular/platform-browser": "^2.3.1",
"@angular/platform-browser-dynamic": "^2.3.1",
"@angular/router": "^3.3.1",
"core-js": "^2.4.1",
"ng2-material-select": "^0.1.4",
"rxjs": "^5.0.1",
"ts-helpers": "^1.1.1",
"zone.js": "^0.7.2"
},
"devDependencies": {
"@angular/compiler-cli": "^2.3.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.3"
}
Upgrading to @angular/[email protected]
worked for me.
Hmm still can't understand why this is closed down - going to try @PierreDuc solution tomorrow to fix this.
Using ngcli beta 24 and created new project (5 days ago). Today, upgraded TSC to 2.14 matching my system version. Got error '... is not an NGModule' on ng serve.
Upgraded all angular components from 2.31 to 2.42
Module builds, no more error, when running ng serve
Unfortunately upgrading to ngcli beta 24, typescript 2.1.4 and angular to 2.4.2 didn't solve my problem - still get the "NgSemanticModule is not an NgModule" error.
Any ideas left?
Hello.
I tired to solve this problem. Yesterday I founded an example here https://github.com/blacksonic/angular2-aot-webpack (big thanks to the author). Today I removed @ngtools/webpack from my project and now I'm using webpack for AoT. I'm happy. Thanks to all.
Pushing back the version of angular-cli
to 1.0.0-beta.21
works for me - even with latest versions of Typescript, Angular and compiler-cli
:
"dependencies": {
"@angular/common": "2.4.2",
"@angular/compiler": "2.4.2",
"@angular/core": "2.4.2",
"@angular/forms": "2.4.2",
"@angular/http": "2.4.2",
"@angular/platform-browser": "2.4.2",
"@angular/platform-browser-dynamic": "2.4.2",
"@angular/router": "3.4.2",
"angular2-jwt": "^0.1.28",
"core-js": "^2.4.1",
"d3": "^4.4.1",
"jquery": "^3.1.1",
"lodash": "^4.17.4",
"ng2-toasty": "^2.2.2",
"rxjs": "^5.0.3",
"semantic-ui": "^2.2.7",
"ts-helpers": "^1.1.2",
"zone.js": "^0.7.4"
},
"devDependencies": {
"@angular/compiler-cli": "2.4.2",
"@types/d3": "^4.4.0",
"@types/jasmine": "2.5.38",
"@types/node": "^6.0.42",
"angular-cli": "1.0.0-beta.21",
"awesome-typescript-loader": "3.0.0-beta.17",
"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.1.4",
"webdriver-manager": "10.2.5"
}
Just tried with the latest release angular-cli: 1.0.0-beta.25.5
and it's not working. Reverting back to 21 for now.
Personally I found a way to make this work on my project, basically I did following:
1) Update all dependencies
2) Then I compared _all_ my files against https://github.com/angular/angular-cli/tree/master/packages/angular-cli/blueprints/ng2/files
3) Make necessary changes to common
files
And after this all worked. And below is my current package.json
{
"name": "angular-cli-frontend",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve --host 0.0.0.0",
"lint": "tslint -t stylish \"src/**/*.ts\"",
"test": "ng test --lint --code-coverage",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/common": "2.4.3",
"@angular/compiler": "2.4.3",
"@angular/core": "2.4.3",
"@angular/forms": "2.4.3",
"@angular/http": "2.4.3",
"@angular/material": "2.0.0-beta.1",
"@angular/platform-browser": "2.4.3",
"@angular/platform-browser-dynamic": "2.4.3",
"@angular/router": "3.4.3",
"angular2-jwt": "0.1.28",
"angular2-moment": "1.1.0",
"core-js": "2.4.1",
"hammerjs": "2.0.8",
"ng2-webstorage": "1.5.0",
"rxjs": "5.0.3",
"ts-helpers": "1.1.2",
"zone.js": "0.7.5"
},
"devDependencies": {
"@angular/compiler-cli": "2.4.3",
"@types/jasmine": "2.5.40",
"@types/node": "7.0.0",
"angular-cli": "1.0.0-beta.25.5",
"codelyzer": "2.0.0-beta.4",
"enhanced-resolve": "3.0.3",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "3.1.0",
"karma": "1.3.0",
"karma-chrome-launcher": "2.0.0",
"karma-cli": "1.0.1",
"karma-jasmine": "1.1.0",
"karma-mocha-reporter": "2.2.1",
"karma-phantomjs-launcher": "1.0.2",
"karma-remap-istanbul": "0.4.0",
"protractor": "5.0.0",
"ts-node": "2.0.0",
"tslint": "4.3.1",
"typescript": "2.1.5"
}
}
FYI, it now works with latest Angular and CLI with the following dependencies:
"dependencies": {
"@angular/common": "2.4.4",
"@angular/compiler": "2.4.4",
"@angular/core": "2.4.4",
"@angular/forms": "2.4.4",
"@angular/http": "2.4.4",
"@angular/platform-browser": "2.4.4",
"@angular/platform-browser-dynamic": "2.4.4",
"@angular/router": "3.4.4",
"angular2-jwt": "^0.1.28",
"core-js": "^2.4.1",
"d3": "^4.4.2",
"jquery": "^3.1.1",
"lodash": "^4.17.4",
"ng2-toasty": "^2.2.2",
"rxjs": "^5.0.3",
"semantic-ui": "^2.2.7",
"ts-helpers": "^1.1.2",
"zone.js": "^0.7.6"
},
"devDependencies": {
"@angular/compiler-cli": "2.4.4",
"@types/d3": "^4.4.1",
"@types/jasmine": "2.5.41",
"@types/node": "^6.0.42",
"angular-cli": "1.0.0-beta.26",
"awesome-typescript-loader": "3.0.0-beta.18",
"codelyzer": "~2.0.0-beta.4",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "3.2.0",
"karma": "1.4.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.1.0",
"karma-remap-istanbul": "^0.4.0",
"protractor": "~5.0.0",
"ts-node": "2.0.0",
"tslint": "^4.3.1",
"typescript": "~2.1.5",
"webdriver-manager": "11.1.1"
}
I had the same problem but I wasnt able to downgrade typescript or angular-cli because in OS X it worked but if I downgrade in Windows doesn't work anymore, so I just instaled NCU npm i -g npm-check-updates
and did an upgrade of all the package.json
and the problem were solved for both OS.
@CanKer Whats the angular version you have after the upgrade?
When I did yarn upgrade
, I got 2.3.1
instead of 2.4.4
@thekalinga this is how my package.json looks after the upgrade
"dependencies": {
"@angular/common": "~2.4.4",
"@angular/compiler": "~2.4.4",
"@angular/core": "~2.4.4",
"@angular/forms": "~2.4.4",
"@angular/http": "~2.4.4",
"@angular/platform-browser": "~2.4.4",
"@angular/platform-browser-dynamic": "~2.4.4",
"@angular/router": "~3.4.4",
"core-js": "^2.4.1",
"ng2-date-picker": "^0.2.1",
"ng2-file-upload": "^1.2.0",
"ng2-smart-table": "^0.5.0",
"rxjs": "5.0.3",
"ts-helpers": "^1.1.1",
"zone.js": "^0.7.6"
},
"devDependencies": {
"@angular/compiler-cli": "^2.3.1",
"@types/jasmine": "^2.2.30",
"@types/node": "^7.0.3",
"angular-2-dropdown-multiselect": "^0.4.0",
"angular-cli": "1.0.0-beta.19-3",
"codelyzer": "2.0.0-beta.4",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "3.2.0",
"karma": "1.4.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.4.0",
"protractor": "5.0.0",
"ts-node": "2.0.0",
"tslint": "4.3.1",
"typescript": "latest",
"awesome-typescript-loader": "latest",
"webdriver-manager": "11.1.1"
}
@CanKer Are you sure your using "angular-cli": "1.0.0-beta.19-3". I'm still having the "Error in X is not an NgModule from an npm linked module. But i'm using the latest CLI.
just ran into this, didnt debug it, but i find it interesting that I am getting this error only after "ng serve", then if i will modify any file, and web pack reruns, it is not displaying this error anymore
** NG Live Development Server is running on http://localhost:4200. **
Hash: 49cd7d49bb76b083774c
Time: 9923ms
chunk {0} polyfills.bundle.js, polyfills.bundle.map (polyfills) 222 kB {4} [initial] [rendered]
chunk {1} main.bundle.js, main.bundle.map (main) 15.6 kB {3} [initial] [rendered]
chunk {2} styles.bundle.js, styles.bundle.map (styles) 10 kB {4} [initial] [rendered]
chunk {3} vendor.bundle.js, vendor.bundle.map (vendor) 2.71 MB [initial] [rendered]
chunk {4} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered]
ERROR in NgSemanticModule is not an NgModule
webpack: Failed to compile.
webpack: Compiling...
Hash: 8d508c11672b2c20762a
Time: 1783ms
chunk {0} polyfills.bundle.js, polyfills.bundle.map (polyfills) 222 kB {4} [initial]
chunk {1} main.bundle.js, main.bundle.map (main) 15.6 kB {3} [initial]
chunk {2} styles.bundle.js, styles.bundle.map (styles) 10 kB {4} [initial]
chunk {3} vendor.bundle.js, vendor.bundle.map (vendor) 2.71 MB [initial]
chunk {4} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry]
webpack: Compiled successfully.
well, today upgraded myself blindly, to:
$ ng -v
angular-cli: 1.0.0-beta.28.3
node: 7.2.1
os: win32 x64
@angular/common: 2.4.7
@angular/compiler: 2.4.7
@angular/core: 2.4.7
@angular/forms: 2.4.7
@angular/http: 2.4.7
@angular/platform-browser: 2.4.7
@angular/platform-browser-dynamic: 2.4.7
@angular/router: 3.4.7`
and
$ tsc -v
Version 2.1.6
I don't see this error anymore... so (at least in my case) it helped... without checking, whatever you guys did: thanks! ;)
@zawor for your information,the latest release is beta 32 and is available under the @angular/cli name, angular-cli will soon be deprecated. :)
Great to hear that your issue is fixed btw
argh... forgot about the change... nevertheless:
$ ng -v
@angular/cli: 1.0.0-beta.32.3 [1.0.0-beta.24]
node: 7.2.1
os: win32 x64
@angular/common: 2.4.7
@angular/compiler: 2.4.7
@angular/core: 2.4.7
@angular/forms: 2.4.7
@angular/http: 2.4.7
@angular/platform-browser: 2.4.7
@angular/platform-browser-dynamic: 2.4.7
@angular/router: 3.4.7
@angular/compiler-cli: 2.4.7
@angular/cli: 1.0.0-beta.32.3
and
$ nr serve
runs without this pesky error as well...
So as Great Joe from the Church of Joe used to say... Cheers and beers! ;)
Currently have this issue with:
"@angular/common": "^2.4.8",
"@angular/compiler": "^2.4.8",
"@angular/core": "^2.4.8",
"@angular/forms": "^2.4.8",
"@angular/http": "^2.4.8",
"@angular/platform-browser": "^2.4.8",
"@angular/platform-browser-dynamic": "^2.4.8",
"@angular/platform-server": "2.4.8",
"@angular/router": "^3.4.8",
"@angular/cli": "1.0.0-beta.32.3",
"@angular/compiler-cli": "^2.4.8",
"typescript": "^2.1.6"
ng serve
works, but both ng build --prod
and ng build --prod --no-aot
fail
I have also tried this with angular 2.4.0 and typescripts, (2.0.10, 2.1.0)
Err, found my error. My loadChildren module started with a downcase when it needed to be upcase.
Getting this error as well now.
Using:
@angular/cli: 1.0.0-rc.0
node: 7.2.1
os: darwin x64
@angular/common: 2.4.8
@angular/compiler: 2.4.8
@angular/core: 2.4.8
@angular/forms: 2.4.8
@angular/http: 2.4.8
@angular/platform-browser: 2.4.8
@angular/platform-browser-dynamic: 2.4.8
@angular/router: 3.4.7
@angular/cli: 1.0.0-rc.0
@angular/compiler-cli: 2.4.8
Also, this error occurs even when running "ng serve", however, after the initial error, when I make changes to the code and save, the code does compile properly and runs. This error only occurs on first run of "ng serve".
Finally, cannot perform "ng build --prod" because of this error.
@expy I had it as well, I just updated from BETA to RC. After running an ng build --aot
I was able to run ng serve
again.
@angular/cli: 1.0.0-rc.0
node: 6.9.1
os: darwin x64
@angular/cli: 1.0.0-rc.0
@angular/common: 2.4.8
@angular/compiler: 2.4.8
@angular/core: 2.4.8
@angular/forms: 2.4.8
@angular/http: 2.4.8
@angular/material: 2.0.0-beta.2
@angular/platform-browser: 2.4.8
@angular/platform-browser-dynamic: 2.4.8
@angular/router: 3.4.8
@angular/compiler-cli: 2.4.8
@expy try deleting node_modules
then:
npm cache clean
npm install
in the project directory.
@0x1ad2 @Meligy I've tried the above, the problem may lie in a Module that isn't up-to-date with the latest Angular2 / Angular-Cli changes.
I've contacted the owner of the Module for more information.
Thanks for you assistance.
@expy isn't using SEMVER suppose to prevent exactly that?
@SylTi that Module is tested and working on @angular v2.4.1. I upgraded my modules and cli yesterday and this was the only issue.
Please see ERROR in PasswordStrengthBarModule is not an NgModule.
The interesting twist here is that ng serve
initially fails with this error, but a rebuild is successful! This is reproducible and is not resolved with the different typescript/angular-cli versions mentioned in this thread.
Been experiencing this issue in a npm package I am working on and finally managed to fix it by AOT compilation using the ngc compiler.
https://angular.io/docs/ts/latest/cookbook/aot-compiler.html#!#compile
I was able to resolve this error by modifying my app.routes. I removed the hashtag reference to internal components on _loadChildren_ routes.
{ path: '/modules', loadChildren: 'app/modules/modules.module#ModulesComponent'}
TO
{ path: '/modules', loadChildren: 'app/modules/modules.module'}
Still run into this error with Angular 4.2.3 . Fix it with very strange @winfinit trick 😄 (angular-cli 1.1.3)
i compiled library with ngc
For me issue is set options "skipMetadataEmit": false
in file tsconfig.aot.json
"skipMetadataEmit": false
that was it.
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._
Most helpful comment
Isn't this exactly the kind of thing Angular CLI is supposed to help with, making sure that all of the versions being installed fit with each other? Seems like a big fail atm.