Search code examples
angularreduxngrxngrx-store

angular ngrx store error Cannot read property 'schedule' of undefined


I tried to implement ngrx/Store with Angular but I am always getting the following error in console, and no content is showed:

"TypeError: Cannot read property 'schedule' of undefined at ObserveOnSubscriber.scheduleMessage"

By the way I am using:

Angular CLI: 1.7.4
Angular: 5.2.11

Since I am new to ngrx/Store I am trying to implement the following example: https://malcoded.com/posts/angular-ngrx-guide

Even I tried with other examples but I am getting always the same above mentioned error.


Solution

  • I was facing same issue while integrating the ngRx/Store in a new application. When I checked the npm install log, I noticed this:

    npm WARN @ngrx/store@6.0.1 requires a peer of @angular/core@^6.0.0 but none is installed. You must install peer dependencies yourself.

    This lead me to believe that @ngRx/Store v6.x requires Angular v6. After uninstalling the @ngRx/Store v6 and downgrading to ngRx/Store v5.2.0, everything worked like a charm.

    Solution in steps:

    1. npm uninstall @ngrx/store
    2. npm install @ngrx/store@5
    3. re-compile app

    Added some more line due to edits restriction