Problem with Ionic Storage & localforage

Hi all,

In the process of refactoring some of my apps to Ionic 2 and am having a problem with Ionic Storage. It seems some others had similar problems with Ionic Storage v 1.x ( Issue with @ionic/storage and LocalForage) but I am using 2.0.1 and having the same problems.

I’ve imported into app.module.ts as import { IonicStorageModule } from '@ionic/storage';

and I’ve added IonicStorageModule.forRoot() to my imports

The error I get is:

Error: Cannot find module "localforage" at v (http://localhost:8100/build/polyfills.js:3:4864) at Object.<anonymous> (http://localhost:8100/build/main.js:141072:7) at __webpack_require__ (http://localhost:8100/build/main.js:20:30) at Object.<anonymous> (http://localhost:8100/build/main.js:141037:67) at __webpack_require__ (http://localhost:8100/build/main.js:20:30) at Object.<anonymous> (http://localhost:8100/build/main.js:125336:73) at __webpack_require__ (http://localhost:8100/build/main.js:20:30) at Object.<anonymous> (http://localhost:8100/build/main.js:162906:70) at __webpack_require__ (http://localhost:8100/build/main.js:20:30) at http://localhost:8100/build/main.js:66:18 at http://localhost:8100/build/main.js:69:10

here is my package.json:

"dependencies": { "@angular/common": "2.4.8", "@angular/compiler": "2.4.8", "@angular/compiler-cli": "2.4.8", "@angular/core": "2.4.8", "@angular/forms": "2.4.8", "@angular/http": "2.4.8", "@angular/platform-browser": "2.4.8", "@angular/platform-browser-dynamic": "2.4.8", "@angular/platform-server": "2.4.8", "@ionic-native/core": "^3.2.4", "@ionic-native/native-audio": "^3.2.4", "@ionic/storage": "^2.0.1", "ionic-angular": "2.2.0", "ionic-native": "2.8.1", "ionicons": "3.0.0", "rxjs": "5.0.1", "sw-toolbox": "3.4.0", "zone.js": "0.7.2" }, "devDependencies": { "@ionic/app-scripts": "1.1.4", "typescript": "2.0.9" }, "cordovaPlugins": [ "cordova-plugin-whitelist", "cordova-plugin-console", "cordova-plugin-statusbar", "cordova-plugin-device", "cordova-plugin-splashscreen", "ionic-plugin-keyboard" ],

Any help would be really appreciated!

Update & Solution! My problem was running node 4.x

So, I uninstalled @ionic/storage, upgraded to node 6.x, rebuilt the bindings (npm rebuild node-sass), reinstalled @ionic/storage and everything works fine. Hope this helps somebody else not waste a few hours.