# V4 and Native storage error?

**URL:** <https://forum.ionicframework.com/t/v4-and-native-storage-error/139609>\
**Category:** Ionic Native\
**Created:** [August 24, 2018, 3:10pm UTC](https://forum.ionicframework.com/t/v4-and-native-storage-error/139609 "2018-08-24T15:10:55Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![israelazo2](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/israelazo2/32/121237_2.png) [@israelazo2](https://forum.ionicframework.com/u/israelazo2)\
**Post date:** [August 24, 2018, 3:10pm UTC](https://forum.ionicframework.com/t/v4-and-native-storage-error/139609/1 "2018-08-24T15:10:55Z")

</div>

Hi

I’m trying v4 and got this problem when importing Native Storage.

Just by adding it to the constructor it fails with an error (check below)

Is it possible to use Native Storage in v4?

```auto
ERROR Error: Uncaught (in promise): TypeError: Object(...) is not a function
TypeError: Object(...) is not a function
    at index.js:133
    at Object../node_modules/@ionic-native/native-storage/index.js (index.js:197)
    at __webpack_require__ (bootstrap:81)
    at Object../src/app/home/home.page.ts (home-home-module.js:307)
    at __webpack_require__ (bootstrap:81)
    at Object../src/app/home/home.module.ts (home-home-module.js:232)
    at __webpack_require__ (bootstrap:81)
    at $_lazy_route_resource lazy namespace object:17
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:388)
    at Object.onInvoke (core.js:3824)
    at index.js:133
    at Object../node_modules/@ionic-native/native-storage/index.js (index.js:197)
    at __webpack_require__ (bootstrap:81)
    at Object../src/app/home/home.page.ts (home-home-module.js:307)
    at __webpack_require__ (bootstrap:81)
    at Object../src/app/home/home.module.ts (home-home-module.js:232)
    at __webpack_require__ (bootstrap:81)
    at $_lazy_route_resource lazy namespace object:17
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:388)
    at Object.onInvoke (core.js:3824)
    at resolvePromise (zone.js:814)
    at resolvePromise (zone.js:771)
    at zone.js:873
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
    at Object.onInvokeTask (core.js:3815)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
    at drainMicroTaskQueue (zone.js:595)

```

---

<div class="post-metadata">

**Author:** ![reedrichards](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@reedrichards](https://forum.ionicframework.com/u/reedrichards)\
**Post date:** [August 24, 2018, 3:14pm UTC](https://forum.ionicframework.com/t/v4-and-native-storage-error/139609/2 "2018-08-24T15:14:37Z")

</div>

Only at least the 7 times on the forum that I link to the same answer [Ionic 4 Beta: Object(...) is not a function](https://forum.ionicframework.com/t/ionic-4-beta-object-is-not-a-function/138152/3?u=reedrichards)

---

<div class="post-metadata">

**Author:** ![israelazo2](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/israelazo2/32/121237_2.png) [@israelazo2](https://forum.ionicframework.com/u/israelazo2)\
**Post date:** [August 27, 2018, 1:34pm UTC](https://forum.ionicframework.com/t/v4-and-native-storage-error/139609/3 "2018-08-27T13:34:44Z")

</div>

Thanks @reedrichards. I hate to be that guy who didn’t search the forum first. I took a look and didn’t find anything because I was sure it was a problem with the storage plugin and not all the plugins.

---

<div class="post-metadata">

**Author:** ![reedrichards](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@reedrichards](https://forum.ionicframework.com/u/reedrichards)\
**Post date:** [August 27, 2018, 4:24pm UTC](https://forum.ionicframework.com/t/v4-and-native-storage-error/139609/4 "2018-08-27T16:24:57Z")

</div>

Not worries, hope your problem is solved now

---

<div class="post-metadata">

**Author:** ![israelazo2](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/israelazo2/32/121237_2.png) [@israelazo2](https://forum.ionicframework.com/u/israelazo2)\
**Post date:** [August 27, 2018, 4:45pm UTC](https://forum.ionicframework.com/t/v4-and-native-storage-error/139609/5 "2018-08-27T16:45:59Z")

</div>

Not really, I’m attending a different project today, but I tried updating with the following commands

`ionic cordova plugin add cordova-plugin-nativestorage@beta ionic cordova plugin add cordova-plugin-nativestorage@5.0.0-beta.16 ionic cordova plugin add cordova-plugin-nativestorage@5.0.0-beta.14`

And always I get a “No matching version found for…” error, I’ll try to find documentation about how to update later.

---

<div class="post-metadata">

**Author:** ![reedrichards](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@reedrichards](https://forum.ionicframework.com/u/reedrichards)\
**Post date:** [August 27, 2018, 4:58pm UTC](https://forum.ionicframework.com/t/v4-and-native-storage-error/139609/6 "2018-08-27T16:58:16Z")

</div>

Maybe, if I may, read again the link I linked above. Your problem as nothing to do with cordova itself but how you included ionic-native in your project

---

<div class="post-metadata">

**Author:** ![VincentPuget](https://avatars.discourse-cdn.com/v4/letter/v/8c91f0/32.png) [@VincentPuget](https://forum.ionicframework.com/u/VincentPuget)\
**Post date:** [September 19, 2018, 4:07pm UTC](https://forum.ionicframework.com/t/v4-and-native-storage-error/139609/7 "2018-09-19T16:07:10Z")

</div>

I think that Native Storage project is not compatible to ionic v4. The Native Storage source code has not been updated since 2 years.

I have the same issue.

@reedrichards According to your post link, there is no `ngx` folder in that project ![native-storage](https://global.discourse-cdn.com/ionicframework/original/3X/9/7/978e51c555e867894dd99c18727e2ed0facc9920.jpeg)

---

<div class="post-metadata">

**Author:** ![reedrichards](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@reedrichards](https://forum.ionicframework.com/u/reedrichards)\
**Post date:** [September 19, 2018, 4:22pm UTC](https://forum.ionicframework.com/t/v4-and-native-storage-error/139609/8 "2018-09-19T16:22:01Z")

</div>

I think that the Native storage wrapper is there, for Ionic v3 and v4

> **[ionic-team/ionic-native](https://github.com/ionic-team/ionic-native/tree/master/src/%40ionic-native/plugins/native-storage)**
>
> Native features for mobile apps built with Cordova/PhoneGap and open web technologies. Complete with TypeScript support. The successor to ngCordova. Pairs exquisitely with a nice bottle of Ionic Fr...

> <https://github.com/ionic-team/ionic-native/blob/v5/src/%40ionic-native/plugins/native-storage/index.ts>

---

<div class="post-metadata">

**Author:** ![VincentPuget](https://avatars.discourse-cdn.com/v4/letter/v/8c91f0/32.png) [@VincentPuget](https://forum.ionicframework.com/u/VincentPuget)\
**Post date:** [September 20, 2018, 7:46am UTC](https://forum.ionicframework.com/t/v4-and-native-storage-error/139609/9 "2018-09-20T07:46:11Z")

</div>

Can not add this plugin to my app.module. I get “Uncaught TypeError: Object(…) is not a function” error.

![nativeStorageError](https://global.discourse-cdn.com/ionicframework/original/3X/b/1/b15f467c3c91e999d81ea428f7809e3fd0674e66.jpeg)

Node: 8.12.0  
ionic (Ionic CLI) : 4.1.2  
Ionic Framework : @ionic/angular 4.0.0-beta.7  
Cordova 8.0.0  
“@ionic-native/core”: “^5.0.0-beta.20”  
“cordova-plugin-nativestorage”: “^2.3.2”,

---

<div class="post-metadata">

**Author:** ![reedrichards](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@reedrichards](https://forum.ionicframework.com/u/reedrichards)\
**Post date:** [September 20, 2018, 8:36am UTC](https://forum.ionicframework.com/t/v4-and-native-storage-error/139609/10 "2018-09-20T08:36:56Z")

</div>

I answered this question like a lot of time on the forum, I even linked one of these answers right here in this post, just scroll up and follow “…to the same answer” in my above post

---

<div class="post-metadata">

**Author:** ![VincentPuget](https://avatars.discourse-cdn.com/v4/letter/v/8c91f0/32.png) [@VincentPuget](https://forum.ionicframework.com/u/VincentPuget)\
**Post date:** [September 20, 2018, 9:14am UTC](https://forum.ionicframework.com/t/v4-and-native-storage-error/139609/11 "2018-09-20T09:14:34Z")

</div>

`npm install @ionic-native/core@beta --save`  
`npm install @ionic-native/native-storage@beta --save`

In my case, ionic-native was installed on beta mode, not @ionic-native/native-storage.

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:22pm UTC](https://forum.ionicframework.com/t/v4-and-native-storage-error/139609/12 "2021-07-19T21:22:39Z")

</div>

Closed on July 19, 2021, 9:22pm UTC


