2

Warning:

Warning: Can't resolve all parameters for Storage in /Users/zzm/Desktop/minan/node_modules/@ionic/storage/es2015/storage.d.ts: (?). This will become an error in Angular v5.x

I followed this answer and did already. But still, shows this warning for me when I build IOS or Android.

Package.json

{
    "name": "ionic-hello-world",
    "author": "He Yuyang",
    "homepage": "http://ionicframework.com/",
    "private": true,
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "4.0.0",
        "@angular/compiler": "4.0.0",
        "@angular/compiler-cli": "4.0.0",
        "@angular/core": "4.0.0",
        "@angular/forms": "4.0.0",
        "@angular/http": "4.0.0",
        "@angular/platform-browser": "4.0.0",
        "@angular/platform-browser-dynamic": "4.0.0",
        "@angular/platform-server": "4.0.0",
        "@ionic-native/core": "4.1.0",
        "@ionic-native/facebook": "^4.1.0",
        "@ionic-native/in-app-browser": "^4.3.0",
        "@ionic-native/onesignal": "^4.2.1",
        "@ionic-native/photo-viewer": "^4.1.0",
        "@ionic-native/qqsdk": "^4.1.0",
        "@ionic-native/social-sharing": "^4.1.0",
        "@ionic/storage": "2.0.0",
        "com-sarriaroman-photoviewer": "^1.1.10",
        "cordova-android": "^6.2.3",
        "cordova-ios": "^4.4.0",
        "cordova-plugin-console": "^1.0.5",
        "cordova-plugin-device": "^1.1.4",
        "cordova-plugin-facebook4": "^1.9.1",
        "cordova-plugin-inappbrowser": "^1.7.1",
        "cordova-plugin-qqsdk": "^0.9.6",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-statusbar": "^2.2.1",
        "cordova-plugin-wechat": "^2.0.0",
        "cordova-plugin-whitelist": "^1.3.2",
        "cordova-plugin-x-socialsharing": "^5.2.0",
        "es6-promise-plugin": "^4.1.0",
        "ionic-angular": "3.6.0",
        "ionic-img-viewer": "^2.6.1",
        "ionic-native": "2.4.1",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionicons": "3.0.0",
        "onesignal-cordova-plugin": "^2.2.0",
        "rxjs": "5.0.0-beta.12",
        "sw-toolbox": "3.4.0",
        "zone.js": "0.6.26"
    },
    "devDependencies": {
        "@ionic/app-scripts": "^2.1.3",
        "typescript": "2.3.4"
    },
    "cordovaPlugins": [
        "cordova-plugin-whitelist",
        "cordova-plugin-console",
        "cordova-plugin-statusbar",
        "cordova-plugin-device",
        "ionic-plugin-keyboard",
        "cordova-plugin-splashscreen"
    ],
    "cordovaPlatforms": [],
    "description": "SidemenuTabs: An Ionic project",
    "cordova": {
        "plugins": {
            "cordova-plugin-console": {},
            "cordova-plugin-device": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-statusbar": {},
            "ionic-plugin-keyboard": {},
            "cordova-plugin-qqsdk": {
                "QQ_APP_ID": "1106340746"
            },
            "cordova-plugin-x-socialsharing": {},
            "com-sarriaroman-photoviewer": {},
            "cordova-plugin-facebook4": {
                "APP_ID": "2027324614162511",
                "APP_NAME": "民安-马来西亚"
            },
            "cordova-plugin-whitelist": {},
            "onesignal-cordova-plugin": {},
            "cordova-plugin-wechat": {
                "WECHATAPPID": "wxec56aa94e0b75717"
            },
            "cordova-plugin-inappbrowser": {}
        },
        "platforms": [
            "android",
            "ios"
        ]
    }
}

UPDATE: provider user-data.ts

import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Events } from 'ionic-angular';
import { Storage } from '@ionic/storage';

import 'rxjs/add/operator/map';

@Injectable()
export class UserDataProvider {
  HAS_LOGGED_IN = 'hasLoggedIn';

  constructor(public http: Http, public events: Events, public storage: Storage) {
    console.log('Hello UserDataProvider Provider');
  }

  login(user: any): void {
    this.storage.set(this.HAS_LOGGED_IN, true);
    this.setUser(user);
    this.events.publish('user:login');
  };

  signup(user: any): void {
    this.storage.set(this.HAS_LOGGED_IN, true);
    this.setUser(user);
    this.events.publish('user:signup');
  };

  logout(): void {
    this.storage.remove(this.HAS_LOGGED_IN);
    this.storage.remove('username');
    this.events.publish('user:logout');
  };

  setUser(user: any): void {
    this.storage.set('user', user);
  };

  getUser(): Promise<any> {
    return this.storage.get('user').then((value) => {
      return value;
    });
  };

  hasLoggedIn(): Promise<boolean> {
    return this.storage.get(this.HAS_LOGGED_IN).then((value) => {
      return value === true;
    });
  };
}

Ionic Info

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.0.1

local packages:

@ionic/app-scripts : 3.1.4
Cordova Platforms  : android 6.3.0 ios 4.4.0
Ionic Framework    : ionic-angular 3.9.2

System:

ios-deploy : 1.9.2
Node       : v6.11.3
npm        : 3.10.10
OS         : macOS Sierra
Xcode      : Xcode 9.1 Build version 9B55

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : pro
Yuyang He
  • 2,252
  • 4
  • 28
  • 51

1 Answers1

1

I highly recommend upgrading your project to latest Ionic and Ionic app-scripts.

Ionic 3.9.2

See this official package.json file.

Note: After that delete the node_modules folder and run npm i

Sampath
  • 63,341
  • 64
  • 307
  • 441
  • I will try to upgrading the project to 3.7.1, but I am worried about is it will show other error for me? Because now the warning not affect the project running. – Yuyang He Oct 13 '17 at 06:24
  • You don't have any other option here.Because you need to upgrade your project anyway to get the latest features and bug fixes.I think this is the time for you. If you'll have different issues then you need to sort out those one by one. – Sampath Oct 13 '17 at 07:27
  • Actually, I import { Storage } from '@ionic/storage'; in my provider, is it problem? And I update code in my question, please chack. Thank you! – Yuyang He Oct 13 '17 at 08:36
  • You can do that.It is not the problem. Again latest `Storage` module is `2.0.1`.You don't have any other option.You must upgrade the app. https://github.com/ionic-team/ionic-storage/releases – Sampath Oct 13 '17 at 08:46
  • You must upgrade the **whole project** according to the reference I have given. You know that Ionic is open source project and they fix huge set of bugs each and every version.So you must keep your project update always. – Sampath Oct 13 '17 at 08:53
  • I upgraded my project to ionic 3.7.1 already, but still showing this error – Yuyang He Dec 04 '17 at 07:36
  • Now it is `3.9.2` with `Angular 5` :D https://github.com/ionic-team/ionic/releases – Sampath Dec 04 '17 at 07:46
  • I will update my ionic info in my question, please check...I tried 3.9.4 and angulea 5 already – Yuyang He Dec 04 '17 at 08:06
  • 1
    Error solved..thank you very much..I delete node_modules and rebuild then success – Yuyang He Dec 04 '17 at 08:21