question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Can't resolve all parameters for Storage: (?, ?).

See original GitHub issue

I’m using @ionic/storage in a non-ionic Angular2 Project. I never noticed this error when using it with Ionic, but I have now seen it while starting 2 Angular2 Projects that make use of the lib.

Error: Can't resolve all parameters for Storage: (?, ?).

I see this runtime error when my app.module.ts is set up as follows:

...
import { Storage } from '@ionic/storage';
@NgModule({
  providers: [
    Storage,
    ...
  ],
  ...
})
export class AppModule{ }

If I use a custom provider with no special values like this:

...
import { Storage } from '@ionic/storage';
export function provideStorage() {
 return new Storage();
}
@NgModule({
  providers: [
        { provide: Storage, useFactory: provideStorage },
    ...
  ],
  ...
})
export class AppModule{ }

then everything works no problem. Is this to be expected? From reading the Documentation it doesn’t seem like this should be necessary (and isn’t in my separate Ionic App).

environment details:

angular-cli: 1.0.0-beta.25.5
node: 6.9.3
os: win32 x64
@angular/common: 2.4.5
@angular/compiler: 2.4.5
@angular/core: 2.4.5
@angular/forms: 2.4.5
@angular/http: 2.4.5
@angular/material: 2.0.0-beta.1
@angular/platform-browser: 2.4.5
@angular/platform-browser-dynamic: 2.4.5
@angular/router: 3.4.5
@angular/compiler-cli: 2.4.5
@ionic/storage: 1.1.7

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:8
  • Comments:29 (2 by maintainers)

github_iconTop GitHub Comments

32reactions
jgw96commented, Mar 3, 2017

Hello all, this is now fixed in the new 2.0.0 release šŸŽ‰. Instructions here on how to update.

13reactions
raproposcommented, Feb 8, 2017

I think the README should be modified somehow to indicate that simply listing Storage in the providers array is not guaranteed to work any more, and that the more elaborate useFactory approach documented under the ā€œConfiguring Storage (new in 1.1.7)ā€ section is mandatory, even if it is as simple as:

export function provideStorage() { return new Storage(); }
{provide: Storage, useFactory: provideStorage},

I believe something in angular-compiler changed somewhere between 2.2 and 4.0.0-beta.5 (perhaps with respect to optional or default parameters), and this is going to start biting people in droves. I tried adding @Optional decorators, but it did not seem to help.

UPDATE

Potentially related to angular #13609?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't resolve all parameters for Storage: (?) - Stack Overflow
When I could not solve the problem, I have installed: npm install @ionic/storage. I have removed: import {Storage} from '@ionic/storage' fromĀ ...
Read more >
Runtime error can't resolve all parameters for storage
I am trying to use the local storage in my project. I am getting the error while running the project.I am new to...
Read more >
Fixing the "can't resolve all parameters" exception with ...
The error was indeed caused by the following imports in my core module: import { CORE_QUILL_EDITOR_CONFIGURATION_SERVICE } from "@app/core";Ā ...
Read more >
Can't resolve all parameters for StorageService-angular.js
Coding example for the question Uncaught Error: Can't resolve all parameters for ... export class StorageService { private storage: Storage;Ā ...
Read more >
Error: Can't resolve all parameters for Storage - Buona Geek
Error: Can't resolve all parameters for Storage ... It it a runtime error and I set up my app.module.ts as follows: ... ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found