Storage- Ionic2 RC

Hi Team,

I am getting below error when i am using Storage in web.

error_handler.js:47EXCEPTION: Uncaught (in promise): Error: No available storage method found.
Error: No available storage method found.
at driverPromiseLoop (http://localhost:8100/build/main.js:87524:33)
at t.invoke (http://localhost:8100/build/polyfills.js:3:9094)
at Object.onInvoke (http://localhost:8100/build/main.js:35840:37)
at t.invoke (http://localhost:8100/build/polyfills.js:3:9045)
at e.run (http://localhost:8100/build/polyfills.js:3:6481)
at http://localhost:8100/build/polyfills.js:3:4583
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9723)
at Object.onInvokeTask (http://localhost:8100/build/main.js:35831:37)
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9659)
at e.runTask (http://localhost:8100/build/polyfills.js:3:7083)

My system info:

Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-rc.6
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.0
ios-deploy version: 1.5.0
ios-sim version: 3.0.0
OS: macOS Sierra
Node Version: v6.9.1
Xcode version: Xcode 7.3.1 Build version 7D1014

Any help is appreciated, as it is already took couple of days to fix from my side.

Storage will not work on web. Storage only compatible with mobile phones.

Thanks Adithya. According to ionic 2 doc https://ionicframework.com/docs/v2/storage/ we can use it for web as well. I want to see what is causing the error, when using in web.

1 Like

Which command you are using? ionic serve or ionic run browser?

Check this, I am using storage in web and it’s working. Just followed steps from this tutorial: https://ionicframework.com/docs/v2/storage/

Thanks. I am using ionic serve

Add browser platform then use ionic run browser.

1 Like

Thanks Adithya. It’s working.

Hi Adithya,

I am unable to run app in Firefox and Safari browser with ionic run browser --target=“safari”. Any Idea, as someone mentioned ionic 2 will not support Firefox.

it is really easy just :
add ‘localstorage’ to driverOrder
like this::
** IonicStorageModule.forRoot({**
** name: “Database”,**
** driverOrder: [“indexeddb”, “localstorage”]**
** }),**

Why are you doing this? I can’t think of any situation where I would want localStorage involved in an Ionic app.

ionic is smart. when u use browser to run youre app IONIC STORAGE use indexeddb,websql ans etc.., in the other side when you run youre app in genymotion or devices IONIC STORAGE use from device storage…
if u run app in browser and get then NOT AVAILABLE ERROR or you`re data store in WebSql instead of indexeddb .just need to add localstorage to driverOrder to fix this.
I had this problem and fix when add localstorage…

I can’t make head or tail of this post. What wasn’t available?