Ionic 2 尝试添加平台时出错



当我做离子服务时,我的离子2项目运行正常 --lab,但是当我尝试在我的离子2项目中添加平台时出现错误。

尝试添加 iOS 时出错

sudipta$ ionic cordova platform add ios
cordova platform add ios --save
You have been opted out of telemetry. To change this, run: cordova telemetry on.
Using cordova-fetch for cordova-ios@^4.4.0
Error: Failed to fetch platform cordova-ios@^4.4.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! Darwin 17.2.0
npm ERR! argv "/usr/local/bin/node" "/Users/sudipta/musicapp/node_modules/.bin/npm" "install" "cordova-ios@^4.4.0" "--production" "--save-exact"
npm ERR! node v6.10.3
npm ERR! npm  v2.15.12
npm ERR! code EPEERINVALID
npm ERR! peerinvalid The package @ionic-native/core@3.10.2 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @ionic-native/device@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/email-composer@4.4.0 wants @ionic-native/core@^4.2.0
npm ERR! peerinvalid Peer @ionic-native/facebook@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/file@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/media@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/native-audio@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/splash-screen@3.10.2 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/status-bar@3.10.2 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/toast@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/transfer@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! Please include the following file with any support request:
npm ERR!     /Users/sudipta/musicapp/npm-debug.log
[ERROR] Exception: 
sudipta$

尝试添加安卓时出错

sudipta$ ionic cordova platform add android
> cordova platform add android --save
Using cordova-fetch for cordova-android@6.2.3
Error: Failed to fetch platform cordova-android@6.2.3
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! Darwin 17.2.0
npm ERR! argv "/usr/local/bin/node" "/Users/sudipta/musicapp/node_modules/.bin/npm" "install" "cordova-android@6.2.3" "--production" "--save-exact"
npm ERR! node v6.10.3
npm ERR! npm  v2.15.12
npm ERR! code EPEERINVALID
npm ERR! peerinvalid The package @ionic-native/core@3.10.2 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @ionic-native/device@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/email-composer@4.4.0 wants @ionic-native/core@^4.2.0
npm ERR! peerinvalid Peer @ionic-native/facebook@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/file@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/media@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/native-audio@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/splash-screen@3.10.2 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/status-bar@3.10.2 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/toast@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/transfer@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! Please include the following file with any support request:
npm ERR!     /Users/sudipta/musicapp/npm-debug.log
[ERROR] Exception: 
sudipta$ 

尝试浏览器时出错

sudipta$ ionic cordova platform add browser
> cordova platform add browser --save
Using cordova-fetch for cordova-browser@^4.1.0
Error: Failed to fetch platform cordova-browser@^4.1.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! Darwin 17.2.0
npm ERR! argv "/usr/local/bin/node" "/Users/sudipta/musicapp/node_modules/.bin/npm" "install" "cordova-browser@^4.1.0" "--production" "--save-exact"
npm ERR! node v6.10.3
npm ERR! npm  v2.15.12
npm ERR! code EPEERINVALID
npm ERR! peerinvalid The package @ionic-native/core@3.10.2 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @ionic-native/device@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/email-composer@4.4.0 wants @ionic-native/core@^4.2.0
npm ERR! peerinvalid Peer @ionic-native/facebook@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/file@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/media@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/native-audio@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/splash-screen@3.10.2 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/status-bar@3.10.2 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/toast@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/transfer@3.14.0 wants @ionic-native/core@^3.6.0
npm ERR! Please include the following file with any support request:
npm ERR!     /Users/sudipta/musicapp/npm-debug.log
[ERROR] Exception: 
sudipta$ 

我正在使用以下版本

sudipta$ ionic -version
3.18.0
sudipta$ node -v
v6.10.3
sudipta$ npm -v
5.5.1
sudipta$ cordova -version
7.1.0
sudipta$ 

我的包.json (更新(

{
"name": "xxxxxxxxxxx",
"version": "1.0.0",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
    "@angular/common": "^5.0.2",
    "@angular/compiler": "^5.0.2",
    "@angular/compiler-cli": "^5.0.2",
    "@angular/core": "^5.0.2",
    "@angular/forms": "^5.0.2",
    "@angular/http": "^5.0.2",
    "@angular/platform-browser": "^5.0.2",
    "@angular/platform-browser-dynamic": "^5.0.2",
    "@angular/tsc-wrapped": "^4.4.6",
    "@ionic-native/core": "^4.4.2",
    "@ionic-native/device": "^4.4.2",
    "@ionic-native/email-composer": "^4.4.2",
    "@ionic-native/facebook": "^4.4.2",
    "@ionic-native/file": "^4.4.2",
    "@ionic-native/media": "^4.4.2",
    "@ionic-native/native-audio": "^4.4.2",
    "@ionic-native/splash-screen": "^4.4.2",
    "@ionic-native/status-bar": "^4.4.2",
    "@ionic-native/toast": "^4.4.2",
    "@ionic-native/transfer": "^3.12.1",
    "@ionic/cloud-angular": "^0.12.0",
    "@ionic/pro": "^1.0.16",
    "@ionic/storage": "^2.1.3",
    "angularfire2": "^5.0.0-rc.3",
    "cordova": "^7.0.1",
    "cordova-android": "^6.4.0",
    "cordova-browser": "^5.0.1",
    "cordova-fabric-plugin": "git+https://github.com/sarriaroman/FabricPlugin.git",
    "cordova-ios": "^4.4.0",
    "cordova-plugin-add-swift-support": "^1.7.0",
    "cordova-plugin-compat": "^1.1.0",
    "cordova-plugin-device": "^1.1.7",
    "cordova-plugin-email-composer": "^0.8.7",
    "cordova-plugin-facebook4": "^1.9.1",
    "cordova-plugin-file": "^5.0.0",
    "cordova-plugin-file-transfer": "^1.7.0",
    "cordova-plugin-ionic": "^2.0.3",
    "cordova-plugin-media": "^4.0.0",
    "cordova-plugin-nativeaudio": "^3.0.9",
    "cordova-plugin-splashscreen": "^4.1.0",
    "cordova-plugin-statusbar": "^2.3.0",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-plugin-x-toast": "^2.6.0",
    "emulator": "^0.1.0",
    "firebase": "^4.5.0",
    "ionic-angular": "^3.9.2",
    "ionic-plugin-deploy": "^0.6.7",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionicons": "3.0.0",
    "phonegap-plugin-push": "^2.1.0",
    "promise-polyfill": "^6.0.2",
    "react-native": "^0.50.3",
    "rxjs": "^5.5.2",
    "superagent": "^3.8.0",
    "sw-toolbox": "3.6.0",
    "zone.js": "^0.8.18"
},
"devDependencies": {
    "@ionic/app-scripts": "^3.1.2",
    "ionic": "3.18.0",
    "typescript": "^2.6.1"
},
"description": "An Ionic project",
"cordova": {
    "plugins": {
        "cordova-plugin-x-toast": {},
        "cordova-plugin-file-transfer": {},
        "cordova-plugin-file": {},
        "cordova-plugin-console": {},
        "cordova-plugin-device": {},
        "cordova-plugin-splashscreen": {},
        "cordova-plugin-statusbar": {},
        "cordova-plugin-whitelist": {},
        "ionic-plugin-keyboard": {},
        "cordova-plugin-nativeaudio": {},
        "cordova-plugin-facebook4": {
            "APP_ID": "xxxxxxxxxxx",
            "APP_NAME": "MusicApp"
        },
        "cordova-plugin-media": {
            "MICROPHONE_USAGE_DESCRIPTION": " "
        },
        "ionic-plugin-deploy": {},
        "cordova-fabric-plugin": {
            "FABRIC_API_KEY": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
            "FABRIC_API_SECRET": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
        },
        "cordova-plugin-email-composer": {},
        "cordova-plugin-ionic": {
            "APP_ID": "xxxxxxxxxxx",
            "CHANNEL_NAME": "Master",
            "UPDATE_METHOD": "auto",
            "UPDATE_API": "https://api.ionicjs.com",
            "MAX_STORE": "2"
        }
    },
    "platforms": [
        "android",
        "browser",
        "ios"
    ]
}
}

离子信息的输出

sudipta$ ionic info
cli packages: (/Users/sudipta/musicapp/node_modules)
    @ionic/cli-utils  : 1.18.0
    ionic (Ionic CLI) : 3.18.0
global packages:
    cordova (Cordova CLI) : 7.1.0 
local packages:
    @ionic/app-scripts : 3.1.2
    Cordova Platforms  : none
    Ionic Framework    : ionic-angular 3.9.2
System:
    Node  : v6.10.3
    npm   : 5.5.1 
    OS    : macOS High Sierra
    Xcode : Xcode 8.3.1 Build version 8E1000a 
Environment Variables:
    ANDROID_HOME : not set
Misc:
    backend : pro
sudipta$ 

因此,我无法构建该应用程序。提前感谢您的帮助。

你会尝试干净地重新安装你的库吗?

rm package-lock.json
rm -r node_modules
npm install

您已将所有本机库设置为在package.json中4.4.2,但是当您添加平台时似乎使用了3.14.03.10.2

PS:除了一个库,分别@ionic-native/transfer设置为3.12.1在你的package.json中,也可以像其他库一样将其设置为4.4.2

将所有软件包降级到3.12.1,问题解决了

{
  "name": "musicapp",
  "version": "1.0.0",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "4.1.3",
    "@angular/compiler": "4.1.3",
    "@angular/compiler-cli": "4.1.3",
    "@angular/core": "4.1.3",
    "@angular/forms": "4.1.3",
    "@angular/http": "4.1.3",
    "@angular/platform-browser": "4.1.3",
    "@angular/platform-browser-dynamic": "4.1.3",
    "@angular/tsc-wrapped": "^4.4.6",
    "@ionic-native/core": "3.10.2",
    "@ionic-native/device": "^3.12.1",
    "@ionic-native/email-composer": "^3.12.1",
    "@ionic-native/facebook": "^3.12.1",
    "@ionic-native/file": "^3.12.1",
    "@ionic-native/media": "^3.13.1",
    "@ionic-native/native-audio": "^3.12.1",
    "@ionic-native/splash-screen": "3.10.2",
    "@ionic-native/status-bar": "3.10.2",
    "@ionic-native/toast": "^3.12.1",
    "@ionic-native/transfer": "^3.12.1",
    "@ionic/cloud-angular": "^0.12.0",
    "@ionic/pro": "^1.0.12",
    "@ionic/storage": "2.0.1",
    "angularfire2": "^5.0.0-rc.3",
    "cordova": "^7.0.1",
    "cordova-browser": "^4.1.0",
    "cordova-fabric-plugin": "git+https://github.com/sarriaroman/FabricPlugin.git",
    "cordova-plugin-add-swift-support": "^1.7.0",
    "cordova-plugin-compat": "^1.1.0",
    "cordova-plugin-console": "^1.0.5",
    "cordova-plugin-device": "^1.1.4",
    "cordova-plugin-email-composer": "^0.8.7",
    "cordova-plugin-facebook4": "^1.9.1",
    "cordova-plugin-file": "~4.3.3",
    "cordova-plugin-file-transfer": "^1.7.0",
    "cordova-plugin-ionic": "^2.0.3",
    "cordova-plugin-media": "^3.0.1",
    "cordova-plugin-nativeaudio": "^3.0.9",
    "cordova-plugin-splashscreen": "^4.0.3",
    "cordova-plugin-statusbar": "^2.2.2",
    "cordova-plugin-whitelist": "^1.3.1",
    "cordova-plugin-x-toast": "^2.6.0",
    "emulator": "^0.1.0",
    "firebase": "^4.5.0",
    "ionic-angular": "3.4.0",
    "ionic-plugin-deploy": "^0.6.7",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionicons": "3.0.0",
    "phonegap-plugin-push": "^1.10.5",
    "promise-polyfill": "^6.0.2",
    "react-native": "^0.17.0",
    "rxjs": "5.4.0",
    "superagent": "^3.8.0",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.12",
    "cordova-ios": "~4.5.3"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^2.1.4",
    "ionic": "3.18.0",
    "typescript": "2.3.3"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-x-toast": {},
      "cordova-plugin-file-transfer": {},
      "cordova-plugin-file": {},
      "cordova-plugin-console": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-whitelist": {},
      "ionic-plugin-keyboard": {},
      "cordova-plugin-nativeaudio": {},
      "cordova-plugin-facebook4": {
        "APP_ID": "1385780158175812",
        "APP_NAME": "MusicApp"
      },
      "cordova-plugin-media": {
        "MICROPHONE_USAGE_DESCRIPTION": " "
      },
      "ionic-plugin-deploy": {},
      "cordova-fabric-plugin": {
        "FABRIC_API_KEY": "6ba227e76d0f8627261d0d3bc96d43e6e4916c12",
        "FABRIC_API_SECRET": "2ac1b92ef246209e5611aacdd20e89d988597eac09a8ccc88c9a550748192e47"
      },
      "cordova-plugin-email-composer": {},
      "cordova-plugin-ionic": {
        "APP_ID": "2c035184",
        "CHANNEL_NAME": "Master",
        "UPDATE_METHOD": "auto",
        "UPDATE_API": "https://api.ionicjs.com",
        "MAX_STORE": "2"
      }
    },
    "platforms": [
      "browser",
      "ios"
    ]
  }
}

相关内容

  • 没有找到相关文章

最新更新