Error: Can't resolve all parameters for Storage: (?, ?).
See original GitHub issueIā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:
- Created 7 years ago
- Reactions:8
- Comments:29 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello all, this is now fixed in the new 2.0.0 release š. Instructions here on how to update.
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 elaborateuseFactory
approach documented under the āConfiguring Storage (new in 1.1.7)ā section is mandatory, even if it is as simple as: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?