Skip to content
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

ERROR in InfiniteScrollModule is not an NgModule #147

Closed
cdibbs opened this issue Apr 12, 2017 · 10 comments
Closed

ERROR in InfiniteScrollModule is not an NgModule #147

cdibbs opened this issue Apr 12, 2017 · 10 comments

Comments

@cdibbs
Copy link

cdibbs commented Apr 12, 2017

The app appears to build correctly, but then gives this error message:

ERROR in InfiniteScrollModule is not an NgModule

I was using Angular 2.4.3. The error persisted after upgrading 4.0.2. I am using Angular CLI @ 1.0.0.

@RomaDotDev
Copy link

It happens for me on 4.0.0 too

When you create AoT build the error message is more specific

ERROR in Unexpected value 'InfiniteScrollModule in /project/node_modules/ngx-infinite-scroll/index.d.ts' imported by the module 'SharedModule in /project/shared/shared.module.ts'. Please add a @NgModule annotation.

Could be related to angular/angular#15763

@borferpa
Copy link

It happens the same for me. I have Angular CLI v1.0.0 and Angular v4.0.1.

ERROR in InfiniteScrollModule is not an NgModule

@orizens
Copy link
Owner

orizens commented Apr 13, 2017

as a reference - this issue is reported for various reasons here:
angular/angular-cli#3426

@ghost
Copy link

ghost commented Apr 13, 2017

I've tried 2 propositions found on angular/angular-cli#3426 :

  • delete node_modules => npm cache clear => npm install
  • two consecutive "ng serve", since several people mentioned it worked for them (error at the first, then compilation ok at the second)

None (or both consecutively) worked for me.

@orizens
Copy link
Owner

orizens commented Apr 13, 2017

@cdibbs , @irsick , @guenam , @borferpa
please try this beta version 0.4.1-7:
npm i ngx-infinite-scroll@0.4.1-7

@cdibbs
Copy link
Author

cdibbs commented Apr 13, 2017

That fixed it! What did you do?

@orizens
Copy link
Owner

orizens commented Apr 13, 2017

@cdibbs I renamed the main module file from index.ts to ngx-infinite-scroll.module.ts and removed the "ngzone" from the tsconfig "files" setting.
I also tried more changes, but i think that was mainly the main issue.

@cdibbs
Copy link
Author

cdibbs commented Apr 13, 2017

I wanted to understand, so I narrowed it down using a local copy of the repo. I repeated what you described, but did only the rename. That worked.

I was also able to leave it as index.ts, but did:

export * from './modules/index';

and after that

export { InfiniteScrollModule } from './modules/index';

Those worked, too. So, it's only the export from the implicitly-specified barrel file that was causing this.

Anyway, thanks for the fast turnaround!

@ghost
Copy link

ghost commented Apr 13, 2017

It worked for me too. Thanks for the super quick fix!

@borferpa
Copy link

It works also for me. Thanks so much @orizens for your speed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants