Unable to use NativeStorage


i am trying to use Native Storage. Followed the instructions as given https://ionicframework.com/docs/v2/native/native-storage/

$ ionic plugin add cordova-plugin-nativestorage
$ npm install --save @ionic-native/native-storage

import { NativeStorage } from ‘@ionic-native/native-storage’;

constructor(private nativeStorage: NativeStorage) { }

However, I am getting run time error as below. Appreciate any help in this regard as I am really stuck. I am new to ionic 2 and it seems like I am missing something basic here.

Runtime Error
Error in ./HomePage class HomePage - caused by: No provider for NativeStorage!
Error: No provider for NativeStorage!
at NoProviderError.BaseError [as constructor] (http://localhost:8100/build/main.js:12557:34)
at NoProviderError.AbstractProviderError [as constructor] (http://localhost:8100/build/main.js:56239:16)
at new NoProviderError (http://localhost:8100/build/main.js:56270:16)
at ReflectiveInjector_.throwOrNull (http://localhost:8100/build/main.js:109657:19)
at ReflectiveInjector
.getByKeyDefault (http://localhost:8100/build/main.js:109685:25)
at ReflectiveInjector
.getByKey (http://localhost:8100/build/main.js:109648:25)
at ReflectiveInjector
.get (http://localhost:8100/build/main.js:109457:21)
at AppModuleInjector.NgModuleInjector.get (http://localhost:8100/build/main.js:56954:52)
at CompiledTemplate.proxyViewClass.AppView.injectorGet (http://localhost:8100/build/main.js:110199:45)
at CompiledTemplate.proxyViewClass.DebugAppView.injectorGet (http://localhost:8100/build/main.js:110441:49)
Ionic Framework: 2.0.0-rc.5
Ionic Native: 2.2.11
Ionic App Scripts: 1.0.0
Angular Core: 2.2.1
Angular Compiler CLI: 2.2.1
Node: 6.9.1
OS Platform: Windows 10
Navigator Platform: Win32
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

Same problem here… help needed

I don’t know why y’all aren’t just using ordinary ionic-storage, but whenever you see “No provider for XXX”, it generally means that you forgot to add XXX to the providers stanza of your app module.

You may need to indicate it in app.module.ts

import {NativeStorage} from “@ionic-native/native-storage”;

and @NgModule

providers: [
{provide: ErrorHandler, useClass: IonicErrorHandler},

The same has happened to me and I have solved it