Issue with @ionic/storage and LocalForage

Alright so I am building an app and everything works just fine from my PC, however I was moving the install to my laptop and am running into an issue that is preventing me from building/serving my app.

After setting everything up on my laptop and installing npm when i try to build I get the following error

node_modules/@ionic/storage/es2015/storage.d.ts, line: 115
Cannot find name ‘LocalForage’.

Now I can go into the node_module and change the import LocalForage from ‘localforage’ to "import * as LocalForage from ‘localforage’ "and that will let it work but I am really curious as to why it runs fine on my computer at home but not on my laptop (obviously dont want to modify node_module files directly to make them work)

i’ve tried installing all typings/packages necessary, below is a snippet of my package.json.

“dependencies”: {
"@angular/common": “2.2.1”,
"@angular/compiler": “2.2.1”,
"@angular/compiler-cli": “2.2.1”,
"@angular/core": “2.2.1”,
"@angular/forms": “2.2.1”,
"@angular/http": “2.2.1”,
"@angular/platform-browser": “2.2.1”,
"@angular/platform-browser-dynamic": “2.2.1”,
"@angular/platform-server": “2.2.1”,
"@ionic/storage": “^1.1.8”,
"@types/jquery": “^2.0.40”,
"@types/localforage": “0.0.33”,
"@types/lodash": “^4.14.52”,
"@types/pluralize": “0.0.27”,
“autopulous-angular2-soap”: “^0.4.7”,
“cordova”: “^6.5.0”,
“firebase”: “^3.6.8”,
“ionic-angular”: “2.0.0”,
“ionic-native”: “2.2.11”,
“ionicons”: “3.0.0”,
“jquery”: “^3.1.1”,
“localforage”: “^1.4.3”,
“lodash”: “^4.17.4”,
“ng-fittext”: “^4.2.1”,
“pluralize”: “^3.1.0”,
“rxjs”: “5.0.0-beta.12”,
“sw-toolbox”: “3.4.0”,
“zone.js”: “0.6.26”
},

Anyone have a clue why @ionic/storage is unable to find LocalForage?

I was having same issue this morning, but I removed the “@ionic/storage”: “^1.1.8” and installed “@ionic/storage”: “1.1.7” instead and the issue was resolved.

1 Like

I hope you didn’t just copy the entire project directory, including node_modules, but if you did, try vaping it and running npm install.

hah no i did not do that, pulled everything in from github (sans the node_modules and all that jazz). I didnt have --save on ionic/storage so when i reinstalled i got 1.1.8 and not 1.1.7. lesson learned to always --save :slight_smile:

FWIW, 1.1.8 works for me, so perhaps something else is going on.

yea it’s gonna be because i have some incorrect dependencies due to having some --save and some not, i just need to go clean up and make sure i have the proper versions of everything in my package.json to i dont do this again

thanks

Facing same issue with version 1.1.7 . Using version 1.1.8 resolves it. :+1:

I’m having this problem with version 2.0.1 anybody else in the same boat?

2 Likes

Yeah, read that this issue was resolved in 2.0.0 but I am still having the problem

None of the @types packages in the OP are relevant any more, so if you have any of them, lose them.