Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: No Provider for Store! in @ngrx 4.x

When migrating my project from @ngrx 2.x to 4.1.0, I encountered the error message

NullInjectorError: No provider for Store!

The store was imported as shown in the docs:

import { StoreModule as NgRxStoreModule } from '@ngrx/store';

@NgModule({
  imports: [
    NgRxStoreModule.forRoot(reducerMap, {
      initialState: initial
    }),
    StoreRouterConnectingModule,
    EffectsModule.forRoot(effects)
  ],
  providers: [AppActions]
})
export class StoreModule {}
like image 250
Anton Poznyakovskiy Avatar asked Feb 05 '23 03:02

Anton Poznyakovskiy


1 Answers

Turned out that some of my services imported the store via

import { Store } from '@ngrx/store/src/store'

Changing the imports to

import { Store } from '@ngrx/store'

fixed the problem.

like image 98
Anton Poznyakovskiy Avatar answered Feb 06 '23 18:02

Anton Poznyakovskiy