Reputation: 153
An error occurred when I was running ionic cordova platform add ios
.It noticed me with the information
[ERROR] Cordova encountered an error. You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova platform add ios --save (exit code 1):
Using cordova-fetch for cordova-ios@^4.4.0
Adding zone.js project...
Error: Your zone.js platform does not have Api.js”
I had tried to update the version of ionic / cordova and also reinstalled node.js and npm.But It still no worked.
Who can tell me how to resolve this problem。Thank you.
Upvotes: 11
Views: 63151
Reputation: 11
try to modify ..//config.xml header
<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>MyApp</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="[email protected]" href="http://ionicframework.com/">Ionic Framework Team</author>
<content src="index.html" />
then run
ionic cordova platform add ios
ionic cordova platform add android
Upvotes: 1
Reputation: 11
If you are on linux or mac run the command with sudo. Problem solved.
Command-Example: sudo ionic cordova platform add android
OUTPUT:
$ sudo ionic cordova platform add android > cordova platform add android --save You have been opted out of telemetry. To change this, run: cordova telemetry on. Using cordova-fetch for cordova-android@~7.1.1 Adding android project... Creating Cordova project for the Android platform: Path: platforms/android Package: io.ionic.starter Name: MyApp Activity: MainActivity Android target: android-27 Android project created with [email protected] Android Studio project detected Android Studio project detected Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project Installing "cordova-plugin-whitelist" for android This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in. Adding cordova-plugin-whitelist to package.json Saved plugin info for "cordova-plugin-whitelist" to config.xml Discovered plugin "cordova-plugin-statusbar" in config.xml. Adding it to the project Installing "cordova-plugin-statusbar" for android Adding cordova-plugin-statusbar to package.json Saved plugin info for "cordova-plugin-statusbar" to config.xml Discovered plugin "cordova-plugin-device" in config.xml. Adding it to the project Installing "cordova-plugin-device" for android Adding cordova-plugin-device to package.json Saved plugin info for "cordova-plugin-device" to config.xml Discovered plugin "cordova-plugin-splashscreen" in config.xml. Adding it to the project Installing "cordova-plugin-splashscreen" for android Adding cordova-plugin-splashscreen to package.json Saved plugin info for "cordova-plugin-splashscreen" to config.xml Discovered plugin "cordova-plugin-ionic-webview" in config.xml. Adding it to the project Installing "cordova-plugin-ionic-webview" for android Subproject Path: CordovaLib Subproject Path: app Adding cordova-plugin-ionic-webview to package.json Saved plugin info for "cordova-plugin-ionic-webview" to config.xml Discovered plugin "cordova-plugin-ionic-keyboard" in config.xml. Adding it to the project Installing "cordova-plugin-ionic-keyboard" for android Adding cordova-plugin-ionic-keyboard to package.json Saved plugin info for "cordova-plugin-ionic-keyboard" to config.xml --save flag or autosave detected Saving android@~7.1.4 into config.xml file ... > ionic cordova resources android --force ✔ Collecting resource configuration and source images - done! ✔ Filtering out image resources that do not need regeneration - done! ✔ Uploading source images to prepare for transformations: 2 / 2 complete - done! ✔ Generating platform resources: 18 / 18 complete - done! ✔ Modifying config.xml to add new image resources - done!
System Description:
Ubuntu 18.04 LTS
Ionic 4.5.0
Cordova 8.1.2
Node v8.14.0
Upvotes: 1
Reputation: 11935
Your iOS platform seems to corrupted. Please remove and re-add the platform to resolve the issue using following commands:
cordova platform rm ios
cordova platform add ios
If it happens when you try ionic cordova run/build android
it will work with the same steps
cordova platform rm android
cordova platform add android
Then run ionic cordova run/build android
and it will work.
Upvotes: 12
Reputation: 153
This problem had been resolved by using commands
cordova platform rm ios
cordova platform add ios --nofetch
Upvotes: 4
Reputation: 191
Use this command:
sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config
And Check this all package are install or not:
global packages:
@ionic/cli-utils : 1.2.0
Cordova CLI : 7.0.1
Ionic CLI : 3.2.0
local packages:
@ionic/app-scripts : 1.3.7
@ionic/cli-plugin-cordova : 1.2.1
@ionic/cli-plugin-ionic-angular : 1.2.0
Cordova Platforms : ios 4.4.0
Ionic Framework : ionic-angular 3.3.0
System:
Node : v6.10.3
OS : macOS Sierra
Xcode : Xcode 8.2.1 Build version 8C1002
ios-deploy : 1.9.1
ios-sim : 5.0.13
Upvotes: 0