Typescript error TS2305 / no exported member 'ModuleWithProviders'

I’m currently trying to follow this nrgx / pouchdb tutorial:

I believe I have made the appropriate changes to update my code for the latest deployed version of Ionic 2 based on the change log, however I am still getting the following typescript error:

TypeScript error: C:/Projects/ionic2-tutorial-ngrx/node_modules/@ngrx/store/ng2.d.ts(5,23): Error TS2305: Module ‘“C:/Projects/ionic2-tutorial-ngrx/node_modules/@angular/core/index”’ has no exported member ‘ModuleWithProviders’.

I’ve googled to no end and I can’t find out what the issue is. Has anyone else encountered this issue and knows what the solution is? Is it perhaps my typings?

1 Like

I had the same problem.

This occurred after installation of ngrx/store (1.0.2) and ngrx/effects (2.0.0-beta2) via npm in my project.

It was related to these errors after npm install:
npm WARN optional Skipping failed optional dependency /chokidar/fsevents: npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14 npm WARN @ngrx/effects@2.0.0-beta.2 requires a peer of @angular/core@^2.0.0-rc.5 but none was installed. npm WARN @ngrx/store@2.1.2 requires a peer of @angular/core@^2.0.0-rc.5 but none was installed.

It’s related to the fact that the latest versions of ngrx/store and ngrx/effects require angular rc5, but this won’t work with Ionic2 Beta 11, but like mentioned by mhartington rc5 will be used in the next version

So until then, I’m downgrading ngrx/store and effects

ModuleWithProviders is used in ngrx/store since this commit: Link

So I switched to ngrx/store@2.1.0 und ngrx/effects@1.0.0:
`
npm uninstall @ngrx/store --save
npm uninstall @ngrx/effects --save
npm install @ngrx/store@2.0.1 --save (<- sorry I stated the wrong version here before. This is the correct one.)
npm install @ngrx/effects@1.0.0 --save

If this still doesn’t work, try to manually delete the store and effects folders under node_modules/ and uninstall and install again.
`
Hope this works for you.

5 Likes

Brilliant! This worked for me. Thanks so much for your post (and for your update - I tried the original post and got the same errors).

I guess I need to pay more attention to the warnings I receive when installing packages.

The package.json from this tutorial installs the latest version. So make sure to replace

"@ngrx/core": "^1.0.1",
"@ngrx/effects": "^1.0.1",
"@ngrx/store": "^2.0.1",

with

"@ngrx/core": "1.0.1",
"@ngrx/effects": "1.0.0",
"@ngrx/store": "2.0.1",

( remove the ^)

otherwise it will install the latest anyways.