找不到模块'UNMET / package.json'

时间:2019-10-18 03:01:05

标签: ionic-framework ionic3 cordova-plugins

我正在尝试在离子应用程序中安装cordova插件。但是每次我尝试安装的每个插件都会抛出错误:

找不到模块'UNMET / package.json'

我已经必须多次删除路径:node_modules,插件,平台,www。

我跑步:

  

npm安装

     

ionic cordova插件添加cordova-plugin-local-notification

     

ionic cordova平台添加android

我试图改变顺序,但是问题没有解决。

我正在Ubuntu 18中运行,离子版本为4.8.0,cordova版本为9.0.0,cordova-lib 9.0.1,节点版本8.10.0,npm 3.5.2。

我只是在终端中运行此行:

ionic cordova plugin add cordova-plugin-local-notification

我的包json:

{
  "name": "project-name",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "android": "ionic cordova run android",
    "start": "ionic-app-scripts serve",
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "buildAndroid": "ionic cordova build android --aot --minifyjs --minifycss"
  },
  "dependencies": {
    "@angular/animations": "5.2.11",
    "@angular/common": "5.2.11",
    "@angular/compiler": "5.2.11",
    "@angular/compiler-cli": "5.2.11",
    "@angular/core": "5.2.11",
    "@angular/fire": "^5.1.1",
    "@angular/forms": "5.2.11",
    "@angular/http": "5.2.11",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@ionic-native/background-geolocation": "^4.20.0",
    "@ionic-native/base64": "^4.20.0",
    "@ionic-native/camera": "^4.20.0",
    "@ionic-native/core": "~4.18.0",
    "@ionic-native/crop": "^4.20.0",
    "@ionic-native/facebook": "^4.20.0",
    "@ionic-native/geolocation": "^4.20.0",
    "@ionic-native/google-plus": "^4.20.0",
    "@ionic-native/local-notifications": "^4.20.0",
    "@ionic-native/location-accuracy": "^4.20.0",
    "@ionic-native/social-sharing": "^4.20.0",
    "@ionic-native/splash-screen": "~4.18.0",
    "@ionic-native/sqlite": "^4.20.0",
    "@ionic-native/status-bar": "~4.18.0",
    "@ionic/storage": "2.2.0",
    "@mauron85/cordova-plugin-background-geolocation": "3.0.3",
    "brmasker-ionic-3": "^1.6.3",
    "com-badrit-base64": "^0.2.0",
    "cordova-plugin-badge": "^0.8.8",
    "cordova-plugin-camera": "^4.0.3",
    "cordova-plugin-crop": "^0.4.0",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-geolocation": "4.0.2",
    "cordova-plugin-googleplus": "7.0.2",
    "cordova-plugin-ionic-keyboard": "^2.1.3",
    "cordova-plugin-ionic-webview": "^3.1.2",
    "cordova-plugin-local-notification": "0.9.0-beta.2",
    "cordova-plugin-request-location-accuracy": "2.3.0",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-plugin-x-socialsharing": "5.4.7",
    "cordova-sqlite-storage": "^3.2.0",
    "es6-promise-plugin": "4.2.2",
    "firebase": "^5.8.4",
    "ionic-angular": "3.9.3",
    "ionicons": "3.0.0",
    "ngx-multilingual": "0.0.3",
    "rxjs": "5.5.11",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.29"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.2.1",
    "@ionic/lab": "1.0.20",
    "typescript": "~2.6.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
      "cordova-plugin-ionic-keyboard": {},
      "cordova-sqlite-storage": {},
      "com-badrit-base64": {},
      "cordova-plugin-camera": {
        "ANDROID_SUPPORT_V4_VERSION": "27.+"
      },
      "cordova-plugin-crop": {},
      "cordova-plugin-mauron85-background-geolocation": {
        "GOOGLE_PLAY_SERVICES_VERSION": "11+",
        "ANDROID_SUPPORT_LIBRARY_VERSION": "26+",
        "ICON": "@mipmap/icon",
        "SMALL_ICON": "@mipmap/icon",
        "ACCOUNT_NAME": "@string/app_name",
        "ACCOUNT_LABEL": "@string/app_name",
        "ACCOUNT_TYPE": "$PACKAGE_NAME.account",
        "CONTENT_AUTHORITY": "$PACKAGE_NAME"
      },
      "cordova-plugin-googleplus": {
        "PLAY_SERVICES_VERSION": "11.8.0"
      },
      "cordova-plugin-geolocation": {
        "GEOLOCATION_USAGE_DESCRIPTION": "Para pegar as melhores promoções"
      },
      "cordova-plugin-request-location-accuracy": {
        "PLAY_SERVICES_LOCATION_VERSION": "16.+"
      },
      "cordova-plugin-x-socialsharing": {
        "ANDROID_SUPPORT_V4_VERSION": "24.1.1+"
      },
      "cordova-plugin-local-notification": {}
    },
    "platforms": [
      "android"
    ]
  }
}

但是每个插件都会引发此错误。

我只需要在我的应用中再次安装插件即可。

1 个答案:

答案 0 :(得分:1)

只需更新npm ,您就可以再次构建:)