Ngx-infinite-scroll: ERROR in InfiniteScrollModule is not an NgModule

Created on 12 Apr 2017  路  10Comments  路  Source: orizens/ngx-infinite-scroll

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.

bug help wanted

Most helpful comment

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!

All 10 comments

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 https://github.com/angular/angular/issues/15763

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

as a reference - this issue is reported for various reasons here:
https://github.com/angular/angular-cli/issues/3426

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.

@cdibbs , @irsick , @guenam , @borferpa
please try this beta version 0.4.1-7:
npm i [email protected]

That fixed it! What did you do?

@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.

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!

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iozozturk picture iozozturk  路  5Comments

bailanyuan picture bailanyuan  路  4Comments

kukiel picture kukiel  路  5Comments

trungk18 picture trungk18  路  4Comments

tuckerjt07 picture tuckerjt07  路  6Comments