Ionic ios failed build - ionic-framework

I have problem when i bulid ios using ionic cordova build ios --release
how can i solve it , i am using macOS
Apple-User:alfraseh FirasHunaiti$ ionic cordova build ios --release
> ionic-app-scripts build --target cordova --platform ios
Error: spawn EACCES
at ChildProcess.spawn (internal/child_process.js:313:11)
at Object.exports.spawn (child_process.js:503:9)
at spawn
(/usr/local/lib/node_modules/ionic/node_modules/cross-spawn/index.js:17:18)
at spawn
(/usr/local/lib/node_modules/ionic/node_modules/#ionic/cli-framework/utils/shell.js:124:12)
at ShellCommand.spawn
(/usr/local/lib/node_modules/ionic/node_modules/#ionic/cli-framework/utils/shell.js:113:16)
at ShellCommand.run
(/usr/local/lib/node_modules/ionic/node_modules/#ionic/cli-framework/utils/shell.js:80:24)
at Shell.<anonymous>
(/usr/local/lib/node_modules/ionic/node_modules/#ionic/cli-utils/lib/shell.js:32:37)
at Generator.next (<anonymous>)
at /usr/local/lib/node_modules/ionic/node_modules/tslib/tslib.js:107:75
at new Promise (<anonymous>)

Build the project for ios (Xcode) sudo ionic cordova prepare iOS or sudo ionic Cordova build ios then go to the platform folder in the project and open with xcode the one that I export to you, and from xcode compile the project.

Related

Unable to build android in IONIC 6

When I run ionic cordova build android –prod i get the error:
Downloading https://services.gradle.org/distributions/gradle-7.1.1-all.zip
Exception in thread "main" java.io.IOException: Downloading from https://services.gradle.org/distributions/gradle-7.1.1-all.zip failed: timeout
I'm behind a proxy, so I set
ionic config set -g proxy http://proxy-..***:9999
I have executed ionic start myApp tabs --cordova --type=angular
I have executed ionic serve
but i can't do the build
I will be very grateful if you can help me please.
Ionic:
Ionic CLI: 6.20.3
Ionic Framework: #ionic/angular 6.3.2
Cordova:
Cordova CLI: 11.0.0
Cordova Platforms: android 10.1.2
Utility:
cordova-res: not installed globally
native-run: not installed globally
System:
NodeJS: v16.17.0 (C:\Program Files\nodejs\node.exe)
npm: 8.15.0
OS: Windows 10
Make sure you already added android in your ionic app then proceed on these steps.
Download the gradle: https://services.gradle.org/distributions/gradle-7.1.1-all.zip
Place the zip file inside: {YourAppName}/platforms/android/gradle
Set an environment variable in your OS: CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL="../gradle-7.1.1-all.zip"
Run ionic cordova build android --prod

Ionic v4: "Ionic cordova run -l" won't start my app

Additional notes for upcoming viewers
This seems to be a common problem on macOS: https://github.com/ios-control/ios-sim/issues/253
Temporary solution below this question.
I've worked on a fresh ionic project a few days ago and I had no problems back then whatsoever.
Today I tried to start the development server: ionic cordova run -l but then I got this error message:
No target specified for emulator. Deploying to undefined simulator
Device type "com.apple.CoreSimulator.SimDeviceType.undefined" could not be found.
An error occurred while running subprocess cordova.
Logging currently available devices(ionic cordova run --list) gives me this output:
Available ios devices:
Available ios virtual devices:
It is empty. None devices are available. Not for ios and neither for android.
Ionic version: 4.12.0
Cordova version: 9.0.0
Nodejs version: 11.5.0
I would appreciate any help to make this work again.
Seems like you have upgraded the Mac OS, faced similar problem in past and updating and re-installing iOS-sim was not of much help.
For me following command worked without installing anything further
ionic cordova emulate ios --livereload --consolelogs --target="iPhone-6,com.apple.CoreSimulator.SimRuntime.iOS-12-2"
Also, you can try this one if above don't work
ionic cordova emulate ios --livereload --consolelogs --target="iPhone-6,com.apple.CoreSimulator.SimRuntime.iOS-12-2" --buildFlag="-UseModernBuildSystem=0"
Do the following:
cd platforms/ios/cordova && npm install ios-sim#latest
cd ../../../
cordova platform rm ios
cordova platform add ios#4.5.0
ionic cordova emulate ios --target --list
ionic cordova plugin rm cordova-plugin-console
That should do it.

ionic app error while building Android APK

I am getting the error while building the ionic app ,ionic-app-script is missing.How to add 'ionic-app-script' file in ionic 2 project? what is the purpose of this file?
just delete platform folder and run
ionic cordova build android --release --prod

Fail to build android Ionic version 1

I have an Ionic version 1 project and install Ionic version 4 on my linux machine.
When trying to build an Android using ionic build android e get this error message:
Unable to load PlatformApi from platform. Error: Cannot find module '/home/myuser/ionic/myapp/platforms/android/cordova/Api.js'
How can i solve this problem?
this issue in latest ionic and cordova versions. try to Run following steps
ionic cordova platform rm browser/android/ios
ionic cordova run --emulator

ionic build --release --prod ios fails

ionic build --release --prod ios has begun failing intermitently and gives the following error:
Error: Error code 65 for command: xcodebuild with args: -xcconfig
Any ideas?
Ionic 2.2.1
Xcode 8
The following procedure worked for me:
deleted the node_module folder
NPM Install
ionic Serve
Stop server
ionic platform add ios
ionic build --release --prod ios