Platform: Property 'forRoot' does not exist on type 'typeof StoreModule'

Created on 4 Feb 2018  路  8Comments  路  Source: ngrx/platform

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ X ] Bug report  
[ ] Feature request
[ X ] Documentation issue or request

What is the current behavior?


Not sure if this is a bug, or a documentation issue, but been using ngrx for a long time, started up a new project today the same as always and got this error.

Attempting to do: StoreModule.forRoot(reducers) produces the error:
Property 'forRoot' does not exist on type 'typeof StoreModule'

I've seen a few blog posts suggesting I try ForFeature instead but it produces pretty much the same error: Property 'forFeature' does not exist on type 'typeof StoreModule'

I've seen something else say just drop it all together and just use StoreModule.. but then I don't understand how to pass the reducers into it.

I tried looking at the example app: https://github.com/ngrx/platform/blob/master/example-app/app/app.module.ts but it's still using forRoot.

Expected behavior:


should compile without errors

Minimal reproduction of the problem with instructions:

attempt to load StoreModule with .forRoot in an angular module.

Version of affected browser(s),operating system(s), npm, node and ngrx:

node: 8.9
npm: 5.6
"@ngrx/core": "^1.2.0",
"@ngrx/effects": "^2.0.3",
"@ngrx/store": "^2.2.2",

Other information:

Most helpful comment

if you just do npm i ngrx it will install version 2.0.1
you need to do npm i @ngrx/store

All 8 comments

Your dependencies are out of date. You have listed NgRx v2.0.0 but the latest release is v5.0.0

I upgraded them to 5 and I'm still seeing the same error:

error TS2339: Property 'forRoot' does not exist on type 'typeof StoreModule'.

I have the same error, therefore I have used 'provideStore' instead of 'forRoot'.

I have the same error, therefore I have used 'provideStore' instead of 'forRoot'.

makes sense

image

@nivle do you have @ngrx/core installed? If so, try removing it.

@timdeschryver yea, I did notice that, anyway thanks, though I gave up on ngrx :D cus I had some other issues with it, and not really the time to fix them, maybe i'll try adding it sometime later.

if you just do npm i ngrx it will install version 2.0.1
you need to do npm i @ngrx/store

Yes, you would install using @ngrx/store. For more installation instructions, see the installation page https://ngrx.io/guide/store/install

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

oxiumio picture oxiumio  路  3Comments

shyamal890 picture shyamal890  路  3Comments

axmad22 picture axmad22  路  3Comments

sandangel picture sandangel  路  3Comments