我一直在努力为ios和android构建我的离子应用程序。我已多次添加和删除平台。升级和降级我的离子应用程序和Java JDK但没有任何作用。现在常见的错误似乎是插件' cordova-custom-config'。
尝试通过命令$ sudo ionic cordova platform add ios@latest --fetch --save --verbose
添加 ios 平台时,错误为:
Discovered plugin "cordova-custom-config" in config.xml. Adding it to the project
Failed to restore plugin "cordova-custom-config" from config.xml. You might need to try adding it again. Error: Failed to fetch plugin cordova-custom-config@^5.0.1 via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! code 1
npm ERR! Command failed: /usr/local/bin/git clone -q git://github.com/xiangpingmeng/plist.js.git /Users/adamgoldberg/.npm/_cacache/tmp/git-clone-87b2ddaf
npm ERR! /Users/adamgoldberg/.npm/_cacache/tmp/git-clone-87b2ddaf/.git: Permission denied
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/adamgoldberg/.npm/_logs/2018-02-07T04_04_30_105Z-debug.log
--save flag or autosave detected
Saving ios@latest into config.xml file ...
[ERROR] Exception:
尝试通过命令$ sudo ionic cordova platform add android@6.3.0 --fetch --save --verbose the error
添加 android 平台时,与 ios 相同。请注意,我添加了 android@6.3.0 ,而不是 android @ latest ,因为最新版本(7.0.0)是错误的。
当我尝试通过命令$ sudo cordova plugin add cordova-custom-config --fetch --verbose
单独添加 cordova-custom-config 插件时,错误是:
(node:16626) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CordovaError: Failed to fetch plugin cordova-custom-config@^5.0.1 via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! code 1
npm ERR! Command failed: /usr/local/bin/git clone -q git://github.com/xiangpingmeng/plist.js.git /Users/adamgoldberg/.npm/_cacache/tmp/git-clone-0ad7ea7b
npm ERR! /Users/adamgoldberg/.npm/_cacache/tmp/git-clone-0ad7ea7b/.git: Permission denied
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/adamgoldberg/.npm/_logs/2018-02-07T04_12_20_482Z-debug.log
(node:16626) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
这是我的ionic info
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.19.1
ionic (Ionic CLI) : 3.19.1
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.8
Cordova Platforms : none
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
ios-sim : 6.0.0
Node : v8.8.1
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 9.2 Build version 9C40b
Environment Variables:
ANDROID_HOME : /Users/adamgoldberg/Library/Android/sdk
Misc:
backend : pro
答案 0 :(得分:2)
尝试安装到以前包含旧版插件的项目时似乎是一个问题。 尝试清理以前的残余物:
rm -Rf node_modules/cordova-custom-config and rm -Rf plugins/cordova-custom-config
如果仍有问题,请安装new cordova-fetch option
cordova plugin add cordova-custom-config --fetch