配置文件有什么问题(OR ion cordova设置); 它找不到任何平台,但我已经安装了ios,PLUS离子尝试添加和失败,因为它存在...下面的例子来自模拟,同样的错误也是由$ionic cordova platform add ios生成的。
$ ionic cordova emulate ios > cordova platform add ios --save ✖ Running command - failed! [WARN] Platform already added. Saving platforms to config.xml. > cordova platform save ✔ Running command - done! [INFO] Running app-scripts build: --platform ios --target cordova [22:44:34] build dev started ... [22:44:34] clean started ... [22:44:34] clean finished in 11 ms [22:44:34] copy started ... [22:44:34] transpile started ... [22:44:38] transpile finished in 4.45 s [22:44:38] preprocess started ... [22:44:38] deeplinks started ... [22:44:39] deeplinks finished in 264 ms [22:44:39] preprocess finished in 265 ms [22:44:39] webpack started ... [22:44:39] copy finished in 4.89 s [22:44:50] webpack finished in 11.63 s [22:44:50] sass started ... [22:44:51] sass finished in 1.04 s [22:44:51] postprocess started ... [22:44:51] removed unused font files [22:44:51] postprocess finished in 10 ms [22:44:51] lint started ... [22:44:51] build dev finished in 17.47 s > ionic cordova prepare [WARN] No Cordova platforms listed in config.xml. Nothing to prepare. You can save your installed platforms to config.xml with the ionic cordova platform save command. [22:44:53] lint finished in 2.11 s这是我的config.xml文件:
<?xml version='1.0' encoding='utf-8'?> <widget id="com.nkt.pms" version="2.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <name>Sys</name> <description>System</description> <author email="support@XXXX.net" href="http://XXXX">The XXXX Team</author> <content src="index.html" /> <access origin="*" /> <allow-navigation href="http://ionic.local/*" /> <allow-navigation href="http://XXXX:8100" /> <allow-intent href="http://*/*" /> <allow-intent href="https://*/*" /> <allow-intent href="tel:*" /> <allow-intent href="sms:*" /> <allow-intent href="mailto:*" /> <allow-intent href="geo:*" /> <preference name="AndroidLaunchMode" value="singleTask" /> <preference name="webviewbounce" value="false" /> <preference name="UIWebViewBounce" value="false" /> <preference name="DisallowOverscroll" value="true" /> <preference name="android-minSdkVersion" value="16" /> <preference name="BackupWebStorage" value="none" /> <preference name="SplashMaintainAspectRatio" value="true" /> <preference name="FadeSplashScreenDuration" value="300" /> <preference name="SplashShowOnlyFirstTime" value="false" /> <preference name="SplashScreen" value="screen" /> <preference name="SplashScreenDelay" value="3000" /> <preference name="orientation" value="portrait" /> <platform name="ios"> <allow-intent href="itms:*" /> <allow-intent href="itms-apps:*" /> <icon height="57" src="resources/ios/icon/icon.png" width="57" /> <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" /> <icon height="40" src="resources/ios/icon/icon-40.png" width="40" /> <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" /> <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" /> <icon height="50" src="resources/ios/icon/icon-50.png" width="50" /> <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" /> <icon height="60" src="resources/ios/icon/icon-60.png" width="60" /> <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" /> <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" /> <icon height="72" src="resources/ios/icon/icon-72.png" width="72" /> <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" /> <icon height="76" src="resources/ios/icon/icon-76.png" width="76" /> <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" /> <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" /> <icon height="29" src="resources/ios/icon/icon-small.png" width="29" /> <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" /> <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" /> <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" /> <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" /> <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" /> <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" /> <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" /> <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" /> <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" /> <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" /> <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" /> <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" /> <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" /> <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" /> </platform> <feature name="StatusBar"> <param name="ios-package" onload="true" value="CDVStatusBar" /> </feature> <icon src="resources/newicon.png" /> <icon src="resources/android/icon/drawable-xhdpi-icon.png" /> <plugin name="cordova-plugin-camera" spec="~2.4.1"> <variable name="CAMERA_USAGE_DESCRIPTION" value=" " /> <variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value=" " /> </plugin> <plugin name="cordova-plugin-console" spec="^1.1.0" /> <plugin name="cordova-plugin-customurlscheme" spec="^4.3.0"> <variable name="URL_SCHEME" value="com.nkt.pms" /> <variable name="ANDROID_SCHEME" value="com.nkt.pms" /> <variable name="ANDROID_HOST" value="pmsys.eu.auth0.com" /> <variable name="ANDROID_PATHPREFIX" value="/cordova/com.nkt.pms/callback" /> </plugin> <plugin name="cordova-plugin-device" spec="^1.1.6" /> <plugin name="cordova-plugin-file" spec="~4.3.3" /> <plugin name="cordova-plugin-file-transfer" spec="~1.6.3" /> <plugin name="cordova-plugin-filepath" spec="~1.0.2" /> <plugin name="cordova-plugin-safariviewcontroller" spec="^1.4.7" /> <plugin name="cordova-plugin-splashscreen" spec="^4.0.3" /> <plugin name="cordova-plugin-statusbar" spec="^2.2.3" /> <plugin name="cordova-plugin-whitelist" spec="^1.3.2" /> <plugin name="cordova-sqlite-storage" spec="^2.0.4" /> <plugin name="ionic-plugin-keyboard" spec="^2.2.1" /> $ ionic info cli packages: (/Users/larsbrenna/Desktop/dev/app/node_modules) @ionic/cli-utils : 1.9.2 ionic (Ionic CLI) : 3.9.2 global packages: Cordova CLI : 7.0.1 local packages: @ionic/app-scripts : 2.1.4 Cordova Platforms : ios Ionic Framework : ionic-angular 3.7.1 System: Node : v6.9.1 npm : 5.4.2 OS : macOS Sierra Xcode : Xcode 9.0 Build version 9A235任何和所有提示和提示赞赏!!
What is wrong with my config files (OR ionic cordova setup); it can't find any platforms but I do have ios installed already, PLUS ionic tries to add and fails because it exists... The example below is from emulate, the same errors are generated by $ionic cordova platform add ios as well.
$ ionic cordova emulate ios > cordova platform add ios --save ✖ Running command - failed! [WARN] Platform already added. Saving platforms to config.xml. > cordova platform save ✔ Running command - done! [INFO] Running app-scripts build: --platform ios --target cordova [22:44:34] build dev started ... [22:44:34] clean started ... [22:44:34] clean finished in 11 ms [22:44:34] copy started ... [22:44:34] transpile started ... [22:44:38] transpile finished in 4.45 s [22:44:38] preprocess started ... [22:44:38] deeplinks started ... [22:44:39] deeplinks finished in 264 ms [22:44:39] preprocess finished in 265 ms [22:44:39] webpack started ... [22:44:39] copy finished in 4.89 s [22:44:50] webpack finished in 11.63 s [22:44:50] sass started ... [22:44:51] sass finished in 1.04 s [22:44:51] postprocess started ... [22:44:51] removed unused font files [22:44:51] postprocess finished in 10 ms [22:44:51] lint started ... [22:44:51] build dev finished in 17.47 s > ionic cordova prepare [WARN] No Cordova platforms listed in config.xml. Nothing to prepare. You can save your installed platforms to config.xml with the ionic cordova platform save command. [22:44:53] lint finished in 2.11 sAnd this is my config.xml file:
<?xml version='1.0' encoding='utf-8'?> <widget id="com.nkt.pms" version="2.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <name>Sys</name> <description>System</description> <author email="support@XXXX.net" href="http://XXXX">The XXXX Team</author> <content src="index.html" /> <access origin="*" /> <allow-navigation href="http://ionic.local/*" /> <allow-navigation href="http://XXXX:8100" /> <allow-intent href="http://*/*" /> <allow-intent href="https://*/*" /> <allow-intent href="tel:*" /> <allow-intent href="sms:*" /> <allow-intent href="mailto:*" /> <allow-intent href="geo:*" /> <preference name="AndroidLaunchMode" value="singleTask" /> <preference name="webviewbounce" value="false" /> <preference name="UIWebViewBounce" value="false" /> <preference name="DisallowOverscroll" value="true" /> <preference name="android-minSdkVersion" value="16" /> <preference name="BackupWebStorage" value="none" /> <preference name="SplashMaintainAspectRatio" value="true" /> <preference name="FadeSplashScreenDuration" value="300" /> <preference name="SplashShowOnlyFirstTime" value="false" /> <preference name="SplashScreen" value="screen" /> <preference name="SplashScreenDelay" value="3000" /> <preference name="orientation" value="portrait" /> <platform name="ios"> <allow-intent href="itms:*" /> <allow-intent href="itms-apps:*" /> <icon height="57" src="resources/ios/icon/icon.png" width="57" /> <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" /> <icon height="40" src="resources/ios/icon/icon-40.png" width="40" /> <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" /> <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" /> <icon height="50" src="resources/ios/icon/icon-50.png" width="50" /> <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" /> <icon height="60" src="resources/ios/icon/icon-60.png" width="60" /> <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" /> <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" /> <icon height="72" src="resources/ios/icon/icon-72.png" width="72" /> <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" /> <icon height="76" src="resources/ios/icon/icon-76.png" width="76" /> <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" /> <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" /> <icon height="29" src="resources/ios/icon/icon-small.png" width="29" /> <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" /> <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" /> <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" /> <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" /> <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" /> <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" /> <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" /> <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" /> <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" /> <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" /> <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" /> <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" /> <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" /> <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" /> </platform> <feature name="StatusBar"> <param name="ios-package" onload="true" value="CDVStatusBar" /> </feature> <icon src="resources/newicon.png" /> <icon src="resources/android/icon/drawable-xhdpi-icon.png" /> <plugin name="cordova-plugin-camera" spec="~2.4.1"> <variable name="CAMERA_USAGE_DESCRIPTION" value=" " /> <variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value=" " /> </plugin> <plugin name="cordova-plugin-console" spec="^1.1.0" /> <plugin name="cordova-plugin-customurlscheme" spec="^4.3.0"> <variable name="URL_SCHEME" value="com.nkt.pms" /> <variable name="ANDROID_SCHEME" value="com.nkt.pms" /> <variable name="ANDROID_HOST" value="pmsys.eu.auth0.com" /> <variable name="ANDROID_PATHPREFIX" value="/cordova/com.nkt.pms/callback" /> </plugin> <plugin name="cordova-plugin-device" spec="^1.1.6" /> <plugin name="cordova-plugin-file" spec="~4.3.3" /> <plugin name="cordova-plugin-file-transfer" spec="~1.6.3" /> <plugin name="cordova-plugin-filepath" spec="~1.0.2" /> <plugin name="cordova-plugin-safariviewcontroller" spec="^1.4.7" /> <plugin name="cordova-plugin-splashscreen" spec="^4.0.3" /> <plugin name="cordova-plugin-statusbar" spec="^2.2.3" /> <plugin name="cordova-plugin-whitelist" spec="^1.3.2" /> <plugin name="cordova-sqlite-storage" spec="^2.0.4" /> <plugin name="ionic-plugin-keyboard" spec="^2.2.1" /> $ ionic info cli packages: (/Users/larsbrenna/Desktop/dev/app/node_modules) @ionic/cli-utils : 1.9.2 ionic (Ionic CLI) : 3.9.2 global packages: Cordova CLI : 7.0.1 local packages: @ionic/app-scripts : 2.1.4 Cordova Platforms : ios Ionic Framework : ionic-angular 3.7.1 System: Node : v6.9.1 npm : 5.4.2 OS : macOS Sierra Xcode : Xcode 9.0 Build version 9A235Any and all tips and hints appreciated!!
最满意答案
Ionic无法找到平台,因为config.xml缺少<engine>标记。 尝试稍微清理您的设置:
运行cordova platform rm ios (您可能会收到未添加平台的错误) 删除platforms文件夹(如果它仍然存在) 如果要重新安装plugins文件夹,也可以删除plugins文件夹 删除package.json与ios平台相关的所有引用 删除node_modules和package-lock.json然后确保cordova和离子CLI是最新的:
(sudo) npm install -g cordova@latest ionic@latest然后一步一步地恢复所有内容:
npm install cordova platform add ios@4.5.1我个人喜欢只通过cordova CLI运行cordova命令而不是通过离子CLI(当运行ionic cordova ...离子CLI只是将与cordova相关的命令转发到cordova CLI,这可能导致错误)。 仅用于构建和运行应用程序,我使用组合命令,因为它更方便。
我还注意到你正在使用旧版本的@ionic/app-scripts和最新的ionic-angular版本。 你也应该升级它。
Ionic can't find the platform because the <engine> tag is missing in config.xml. Try cleaning up your setup a bit:
Run cordova platform rm ios (you may get an error that the platform is not added) Remove the platforms folder if it still exists Maybe also remove the plugins folder if you want them reinstalled Remove all references related to the ios platform in package.json Delete node_modules and package-lock.jsonThen make sure cordova and ionic CLIs are up to date:
(sudo) npm install -g cordova@latest ionic@latestThen restore everything step by step:
npm install cordova platform add ios@4.5.1I personally like to run the cordova commands just through the cordova CLI not via the ionic CLI (when running ionic cordova ... the ionic CLI just forwards cordova related commands to the cordova CLI, which can lead to errors). Just for building and running the app I use the combined commands because its more convenient.
I also noticed that you are using an old version of @ionic/app-scripts with the newest ionic-angular version. You should upgrade this too.
更多推荐
发布评论