简体   繁体   中英

Warning: Can't resolve all parameters for Storage in PATH/node_modules/@ionic/storage/es2015/storage.d.ts: (?)

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM