ionic-team / ionic-starter-super

The Ionic 2 Super Starter 🎮

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Runtime error from update to Storage 2.0.0

ryanrain opened this issue · comments

as of the ionic 2.2.0 release, running

ionic start myapp super --v2

and then serving it gets you a runtime error off the bat.
From https://github.com/driftyco/ionic-storage/releases/tag/v2.0.0
Update Steps:

  1. Run npm install @ionic/storage@2.0.0 --save --save-exact
  2. Remove Storage from your providers in app.module.ts
  3. import { IonicStorageModule } from '@ionic/storage' instead of import { IonicStorage } from '@ionic/storage' in app.module.ts
  4. Add IonicStorageModule.forRoot() to the imports array in app.module.ts

@mlynch this repo has a bunch of pull requests and could use some love too! sorry to nag ;)

Thanks, we're not quite production ready with this repo yet, wanted to get some feedback over the last month or so. We'll tend to it a bit now that things are more stable soon

@ryanrain
So in #2, could you provide us newbies with more information on the correct way to do this step. I tried but kept getting red squiggly lines. In my app.module.ts that I got just a few minutes ago, I did step #1. The providers() in @NgModule was empty already between the parenthesis. Also, in @NgModule, I see this: IonicModule.forRoot(MyApp) NOT what is written in your #4. Which one is correct?

@ryanrain The instructions given above DO NOT help or solve anything, they're just the instructions on how to update to ionic-storage 2.0 for vanilla Ionic apps.

I have no idea why they were posted, and I can confirm that even after following those steps my app still isn't working. Its like they completely changed the way the Storage module works and have invalidated the super starter.

For now we'll wait for an update to the super starter before being able to update to 2.2.0...I wish I knew more about the internals of the Ionic Storage module and could fix this

@LiveListMobile @mikehamil10
unfortunately i too am just starting to use ionic, and so can't yet be of much help here. if i could i would have submitted a nice pull request... other templates, such as blank, or tabs, still work:
ionic start myApp blank --v2

Take a look at the new documentation here, can you try changing it to that in the meantime and let me know if it works for you? We'll have to do a patch anyways but I can't get to it for a bit.

Note the change to IonicStorageModule and specifying it in the imports rather than as a provider.

http://ionicframework.com/docs/v2/storage/

@mlynch many thanks! reading code in this repo is super (sorry) useful to those of us who are just starting to use ionic etc., and in need of guidance re: best practices.
sidenote: a fork i made with ngrx/store and ngrx-store-ionic-storage: https://github.com/ryanrain/ionic-starter-super

I have opened a PR here with the changes that worked for me.

@pwespi I've copied the changes you have made in your PR and they have worked for me also, nice work,

@pwespi so sad :-/ as it still doesn't work for me as everything seems to be correctly setup.

Error is :

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

Environment :
Ionic Framework: 2.2.0
Ionic Native: 2.4.1
Ionic App Scripts: 1.1.4
Angular Core: 2.4.8
Angular Compiler CLI: 2.4.8

Dependencies:
...
"@angular/platform-browser-dynamic": "2.4.8",
"@angular/platform-server": "2.4.8",
"@ionic/storage": "2.0.0",
"ionic-angular": "2.2.0",
"ionic-native": "2.4.1",
...

@slegouffe Sorry to hear that. Maybe try starting again from a bare app with the super template ionic start super-storage-test super --v2 and replace the app.module.ts with this.

@pwespi: another confirmation here. The updated ionic docs include the correct way to reference the Storage module.

Fixed in #82