cordova 8.0.0节点8.11.1 npm 5.6.0

在我们的构建过程中,我们称之为“cordova platform add android”,它在构建项目之前安装所有插件和所需的平台 .

在我将cordova升级到版本8.0.0和所有插件(及其依赖项)之后,我总是在调用平台添加时出错 .

我得到的错误是:

无法从config.xml恢复插件“cordova-plugin-camera” . 您可能需要尝试重新添加它 . 错误:无法通过注册表获取插件cordova-plugin-camera@4.0.3 . 可能这是连接问题,或者插件规范不正确 . 检查您的连接和插件名称/版本/ URL . 无法获得已安装模块的绝对路径

似乎更改插件的顺序会导致相同的错误到不同的插件! node_modules使用正确的插件进行更新 . 通过“cordova plugin add”手动安装插件成功通过 .

知道什么可能导致这种奇怪的行为吗?

的package.json:

{
  "name": "lol",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "@types/bcryptjs": "2.4.1",
    "com.plugin.imei": "https://github.com/aquto/cordova-plugin-imei.git",
    "cordova-android": "7.1.1",
    "cordova-ios": "4.5.4",
    "cordova-custom-config": "5.0.2",
    "cordova-plugin-whitelist": "1.3.3",
    "cordova-plugin-file": "5.0.0",
    "cordova-plugin-media": "4.0.0",
    "cordova-plugin-android-permissions": "1.0.0",
    "cordova-plugin-app-version": "0.1.9",
    "cordova-plugin-ble-central": "1.2.2",
    "cordova-plugin-camera": "4.0.3",
    "cordova-plugin-chrome-apps-common": "1.0.7",
    "cordova-plugin-chrome-apps-iossocketscommon": "1.0.2",
    "cordova-plugin-chrome-apps-sockets-tcp": "1.3.7",
    "cordova-plugin-chrome-apps-system-network": "1.1.2",
    "cordova-plugin-compat": "1.2.0",
    "cordova-plugin-device": "2.0.2",
    "cordova-plugin-dialogs": "2.0.1",
    "cordova-plugin-geolocation": "4.0.1",
    "cordova-plugin-imei": "https://github.com/aquto/cordova-plugin-imei.git",
    "cordova-plugin-inappbrowser": "3.0.0",
    "cordova-plugin-keyboard": "1.2.0",
    "cordova-plugin-network-information": "2.0.1",
    "cordova-plugin-photo-library": "2.1.1",
    "cordova-plugin-splashscreen": "5.0.2",
    "cordova-plugin-statusbar": "2.4.2",
    "cordova-sqlite-storage": "2.4.0",
    "cordova.plugins.diagnostic": "4.0.8",
    "jasmine-reporters": "2.2.1",
    "sqli-cordova-disk-space-plugin": "1.0.2",
    "underscore": "1.8.3",
    "cordova-plugin-ionic-webview": "1.1.16",
    "cordova-plugin-add-swift-support": "1.7.2"
  },
  "cordova": {
    "plugins": {
      "cordova-custom-config": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-file": {},
      "cordova-plugin-media": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-ble-central": {},
      "cordova-plugin-background-mode": {},
      "cordova-plugin-geolocation": {},
      "cordova-plugin-android-permissions": {},
      "cordova-plugin-app-version": {},
      "cordova-plugin-chrome-apps-common": {},
      "cordova-plugin-chrome-apps-iossocketscommon": {},
      "cordova-plugin-chrome-apps-sockets-tcp": {},
      "cordova-plugin-chrome-apps-system-network": {},
      "cordova-plugin-dialogs": {},
      "cordova-plugin-keyboard": {},
      "cordova-plugin-network-information": {},
      "cordova-sqlite-storage": {},
      "cordova.plugins.diagnostic": {},
      "sqli-cordova-disk-space-plugin": {},
      "com.plugin.imei": {},
      "cordova-plugin-compat": {},
      "cordova-plugin-camera": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-photo-library": {},
      "cordova-plugin-add-swift-support": {}
    },
    "platforms": [
      "android",
      "ios"
    ]
  },
  "devDependencies": {
    "bcryptjs": "2.4.3",
    "html-loader": "^0.5.5",
    "html-webpack-plugin": "^3.2.0",
    "ts-loader": "^4.5.0",
    "typescript": "2.6.2",
    "webpack": "^4.16.5",
    "webpack-cli": "^3.1.0",
    "webpack-dev-server": "^3.1.5"
  },
  "scripts": {
    "serv": "webpack-dev-server --mode development --open",
    "build": "webpack --mode production"
  }
}

config.xml中

<?xml version="1.0" encoding="utf-8"?>
<widget defaultlocale="en-US" id="lol" version="13.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:tools="http://schemas.android.com/tools" xmlns:vs="http://schemas.microsoft.com/appx/2014/htmlapps">
  <name>lol</name>
  <description>A blank project that uses Apache Cordova to help you build an app that targets multiple mobile platforms: Android, iOS, Windows, and Windows Phone.</description>
  <author email="dev@cordova.apache.org" href="http://cordova.io">Apache Cordova Team</author>
  <content src="index.html" />
  <access origin="*" />
  <vs:features />
  <custom-preference name="SplashScreen" value="screen" />
  <custom-preference name="SplashMaintainAspectRatio" value="true" />
  <custom-preference name="ShowSplashScreenSpinner" value="false" />
  <custom-preference name="windows-target-version" value="10.0" />
  <custom-preference name="loadUrlTimeoutValue" value="900000" />
  <custom-preference name="FadeSplashScreen" value="false" />
  <custom-preference name="AutoHideSplashScreen" value="true" />
  <custom-preference name="SplashScreenDelay" value="4000" />
  <custom-preference name="WindowsToastCapable" value="true" />
  <custom-preference name="StatusBarOverlaysWebView" value="false" />
  <custom-preference name="StatusBarStyle" value="lightcontent" />
  <custom-preference name="StatusBarBackgroundColor" value="#121212" />
  <custom-preference name="Orientation" value="portrait" />
  <custom-preference name="ShowTitle" value="False" />
  <custom-preference name="CordovaWebViewEngine" value="CDVUIWebViewEngine" />
  <custom-preference name="SuppressesIncrementalRendering" value="True" />
  <custom-preference name="webviewbounce" value="false" />
  <custom-preference name="UIWebViewBounce" value="false" />
  <custom-preference name="DisallowOverscroll" value="true" />
  <allow-intent href="http://*/*" />
  <allow-intent href="https://*/*" />
  <allow-intent href="tel:*" />
  <allow-intent href="sms:*" />
  <allow-intent href="mailto:*" />
  <allow-intent href="geo:*" />
  <platform name="android">
    <allow-intent href="market:*" />
  </platform>
  <platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
  </platform>
  <platform name="android">
    <icon density="ldpi" src="res/icons/android/icon-36-ldpi.png" />
    <icon density="mdpi" src="res/icons/android/icon-48-mdpi.png" />
    <icon density="hdpi" src="res/icons/android/icon-72-hdpi.png" />
    <icon density="xhdpi" src="res/icons/android/icon-96-xhdpi.png" />
    <icon density="xxhdpi" src="res/icons/android/icon-144-xxhdpi.png" />
    <icon density="xxxhdpi" src="res/icons/android/icon-192-xxxhdpi.png" />
  </platform>
  <platform name="ios">
    <icon height="60" src="res/icons/ios/icon-60.png" width="60" />
    <icon height="120" src="res/icons/ios/icon-60-2x.png" width="120" />
    <icon height="76" src="res/icons/ios/icon-76.png" width="76" />
    <icon height="152" src="res/icons/ios/icon-76-2x.png" width="152" />
    <icon height="57" src="res/icons/ios/icon-57.png" width="57" />
    <icon height="114" src="res/icons/ios/icon-57-2x.png" width="114" />
    <icon height="72" src="res/icons/ios/icon-72.png" width="72" />
    <icon height="144" src="res/icons/ios/icon-72-2x.png" width="144" />
    <icon height="29" src="res/icons/ios/icon-small.png" width="29" />
    <icon height="58" src="res/icons/ios/icon-small-2x.png" width="58" />
    <icon height="50" src="res/icons/ios/icon-50.png" width="50" />
    <icon height="100" src="res/icons/ios/icon-50-2x.png" width="100" />
    <icon height="40" src="res/icons/ios/icon-40.png" width="40" />
    <icon height="80" src="res/icons/ios/icon-40-2x.png" width="80" />
    <icon height="180" src="res/icons/ios/icon-60-3x.png" width="180" />
  </platform>
  <platform name="windows">
    <icon height="150" src="res/icons/windows/Square150x150Logo.scale-100.png" width="150" />
    <icon height="360" src="res/icons/windows/Square150x150Logo.scale-240.png" width="360" />
    <icon height="30" src="res/icons/windows/Square30x30Logo.scale-100.png" width="30" />
    <icon height="310" src="res/icons/windows/Square310x310Logo.scale-100.png" width="310" />
    <icon height="44" src="res/icons/windows/Square44x44Logo.scale-100.png" width="44" />
    <icon height="106" src="res/icons/windows/Square44x44Logo.scale-240.png" width="106" />
    <icon height="70" src="res/icons/windows/Square70x70Logo.scale-100.png" width="70" />
    <icon height="71" src="res/icons/windows/Square71x71Logo.scale-100.png" width="71" />
    <icon height="170" src="res/icons/windows/Square71x71Logo.scale-240.png" width="170" />
    <icon height="50" src="res/icons/windows/StoreLogo.scale-100.png" width="50" />
    <icon height="120" src="res/icons/windows/StoreLogo.scale-240.png" width="120" />
    <icon height="150" src="res/icons/windows/Wide310x150Logo.scale-100.png" width="310" />
    <icon height="360" src="res/icons/windows/Wide310x150Logo.scale-240.png" width="744" />
  </platform>
  <platform name="wp8">
    <icon height="99" src="res/icons/wp8/ApplicationIcon.png" width="99" />
    <icon height="159" src="res/icons/wp8/Background.png" width="159" />
  </platform>
  <platform name="android">
    <splash density="port-ldpi" src="res/screens/android/screen-ldpi-portrait.png" />
    <splash density="port-mdpi" src="res/screens/android/screen-mdpi-portrait.png" />
    <splash density="port-hdpi" src="res/screens/android/screen-hdpi-portrait.png" />
    <splash density="port-xhdpi" src="res/screens/android/screen-xhdpi-portrait.png" />
    <splash density="port-xxhdpi" src="res/screens/android/screen-xxhdpi-portrait.png" />
    <splash density="port-xxxhdpi" src="res/screens/android/screen-xxxhdpi-portrait.png" />
    <splash density="land-ldpi" src="res/screens/android/screen-ldpi-landscape.png" />
    <splash density="land-mdpi" src="res/screens/android/screen-mdpi-landscape.png" />
    <splash density="land-hdpi" src="res/screens/android/screen-hdpi-landscape.png" />
    <splash density="land-xhdpi" src="res/screens/android/screen-xhdpi-landscape.png" />
    <splash density="land-xxhdpi" src="res/screens/android/screen-xxhdpi-landscape.png" />
    <splash density="land-xxxhdpi" src="res/screens/android/screen-xxxhdpi-landscape.png" />
  </platform>
  <platform name="ios">
    <splash src="res/screens/ios/Default@2x~iphone~anyany.png" />
    <splash src="res/screens/ios/Default@2x~iphone~comany.png" />
    <splash src="res/screens/ios/Default@2x~iphone~comcom.png" />
    <splash src="res/screens/ios/Default@3x~iphone~anyany.png" />
    <splash src="res/screens/ios/Default@3x~iphone~anycom.png" />
    <splash src="res/screens/ios/Default@3x~iphone~comany.png" />
    <splash src="res/screens/ios/Default@2x~ipad~anyany.png" />
    <splash src="res/screens/ios/Default@2x~ipad~comany.png" />
  </platform>
  <platform name="windows">
    <splash height="300" src="res/screens/windows/SplashScreen.scale-100.png" width="620" />
    <splash height="1920" src="res/screens/windows/SplashScreen.scale-240.png" width="1152" />
    <splash height="1920" src="res/screens/windows/SplashScreenPhone.scale-240.png" width="1152" />
  </platform>
  <platform name="wp8">
    <splash height="1280" src="res/screens/wp8/SplashScreenImage.png" width="768" />
  </platform>
  <platform name="android">
    <custom-preference name="android-manifest/@xmlns:tools" value="http://schemas.android.com/tools" />
    <custom-preference name="android-manifest/application/@tools:replace" value="android:allowBackup" />
    <custom-preference name="android-manifest/application/@android:allowBackup" value="false" />
    <custom-preference name="android-manifest/application/@android:fullBackupContent" value="false" />
    <custom-config-file parent="/*" target="AndroidManifest.xml">
      <meta-data android:name="android.support.VERSION" android:value="25.3.1" tools:replace="android:value" />
      <uses-feature android:name="android.hardware.location.network" />
    </custom-config-file>
  </platform>
  <platform name="ios">
    <custom-preference name="ios-XCBuildConfiguration-SWIFT_VERSION" value="3.0" xcconfigEnforce="true" />
    <custom-config-file parent="UIBackgroundModes" target="*-Info.plist">
      <array>
        <string>bluetooth-central</string>
      </array>
    </custom-config-file>
  </platform>
  <engine name="android" spec="7.1.1" />
  <engine name="ios" spec="4.5.4" />
  <plugin name="cordova-custom-config" spec="5.0.2" />
  <plugin name="cordova-plugin-whitelist" spec="1.3.3" />
  <plugin name="cordova-plugin-file" spec="5.0.0" />
  <plugin name="cordova-plugin-media" spec="4.0.0">
    <variable name="MICROPHONE_USAGE_DESCRIPTION" value="Need microphone access to function properly" />
  </plugin>
  <plugin name="cordova-plugin-statusbar" spec="2.4.2" />
  <plugin name="cordova-plugin-device" spec="2.0.2" />
  <plugin name="cordova-plugin-ble-central" spec="1.2.2" />
  <plugin name="cordova-plugin-geolocation" spec="4.0.1" />
  <plugin name="cordova-plugin-android-permissions" spec="1.0.0" />
  <plugin name="cordova-plugin-app-version" spec="0.1.9" />
  <plugin name="cordova-plugin-chrome-apps-common" spec="1.0.7" />
  <plugin name="cordova-plugin-chrome-apps-iossocketscommon" spec="1.0.2" />
  <plugin name="cordova-plugin-chrome-apps-sockets-tcp" spec="1.3.7" />
  <plugin name="cordova-plugin-chrome-apps-system-network" spec="1.1.2" />
  <plugin name="cordova-plugin-dialogs" spec="2.0.1" />
  <plugin name="cordova-plugin-keyboard" spec="1.2.0" />
  <plugin name="cordova-plugin-network-information" spec="2.0.1" />
  <plugin name="cordova-sqlite-storage" spec="2.4.0" />
  <plugin name="cordova.plugins.diagnostic" spec="4.0.8" />
  <plugin name="sqli-cordova-disk-space-plugin" spec="1.0.2" />
  <plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
  <plugin name="com.plugin.imei" spec="https://github.com/aquto/cordova-plugin-imei.git" />
  <plugin name="cordova-plugin-compat" spec="1.2.0" />
  <plugin name="cordova-plugin-camera" spec="4.0.3">
    <variable name="CAMERA_USAGE_DESCRIPTION" value="Need camera access to function properly" />
    <variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="Need photo library access to function properly" />
  </plugin>
  <plugin name="cordova-plugin-ionic-webview" spec="1.1.16" />
  <plugin name="cordova-plugin-inappbrowser" spec="3.0.0" />
  <plugin name="cordova-plugin-photo-library" spec="2.1.1">
    <variable name="PHOTO_LIBRARY_USAGE_DESCRIPTION" value="Need photo library access to function properly" />
  </plugin>
  <plugin name="cordova-plugin-add-swift-support" spec="1.7.2" />
</widget>