Ionic Emulate iOS/Android command not working - ios

Context: I am currently on Ionic version 3.15.2. The 'ionic serve' command works. The 'ionic cordova emulate ios' and 'ionic cordova emulate android' do not work. I have tried deleting/reinstalling certain packages and dependencies from Ionic but nothing has helped. I have a feeling I need to delete/reinstall Xcode all together but I figured I would ask for help here first. This is the error message I get on my terminal when I try to use the Ionic simulator/emulator:
Command /usr/bin/codesign failed with exit code 1
** BUILD FAILED **
The following build commands failed:
CodeSign build/emulator/****app.app
(1 failure)
Error: Error code 65 for command: xcodebuild with args:
-xcconfig,/Users/*****/Desktop/*****/platforms/ios/cordova/build-debug.xcconfig,-workspace,****app.xcworkspace,-scheme,****app,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS
Simulator,name=iPhone
5s,build,CONFIGURATION_BUILD_DIR=/Users/*****/Desktop/****/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/****/Desktop/****/platforms/ios/build/sharedpch
[ERROR] An error occurred while running cordova emulate ios (exit code 1).
Note: I used the asterisks in place of the path for privacy reasons
It's weird that ionic serve works but the other two commands don't...

Even ionic info should fail with the latter error.
It's because of the module #ionic/cli-plugin-proxy. As soon as I uninstalled it I could successfully run ionic info. But it detected IONIC_HTTP_PROXY in my environment and asked me to install it again.
So I did manually later, but the error returned. So I installed the missing module using npm install -g #ionic/cli-framework. After that I could successfully run ionic info again.
Therefor I guess it's an unresolved dependency issue inside the #ionic/cli-plugin-proxy module.

Related

Ionic Build iOS - Fail

I've been workign on this project for months now with no major issues. Today I can't even get it to build out. I ran "$ionic resources" and now I can't get my build to work at all.
I'm getting this error:
** BUILD FAILED **
The following build commands failed:
CompileAssetCatalog build/emulator/Stopper.app Stopper/Images.xcassets
(1 failure)
ERROR building one of the platforms: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/colemanjeff/GitHub/StopperRC1/platforms/ios/cordova/build-debug.xcconfig,-project,Stopper.xcodeproj,ARCHS=i386,-target,Stopper,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/colemanjeff/GitHub/StopperRC1/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/colemanjeff/GitHub/StopperRC1/platforms/ios/build/sharedpch
You may not have the required environment or OS to build this project
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/colemanjeff/GitHub/StopperRC1/platforms/ios/cordova/build-debug.xcconfig,-project,Stopper.xcodeproj,ARCHS=i386,-target,Stopper,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/colemanjeff/GitHub/StopperRC1/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/colemanjeff/GitHub/StopperRC1/platforms/ios/build/sharedpch
I'm not sure what caused the problem or how to fix it. Anyone have any idea?
Turns out I actually did need to uninstall the platform, remove the plugin json file, and then reinstall everything.
Run (this will remove the old ionic ios platform)
sudo ionic platform rm ios
Then (this will install a new platform with privileges)
sudo ionic platform add ios
Then build your code ios/android
ionic build ios
ionic build android
This fixed it for me!
Might be that you should also run
sudo ionic resources
to generate new icon and splash screens.
Basically, re-installation of Platform and Plugins once again resolves the issue.

ionic emulate ios - won't emulate and says no such file or directory

Ran add ios and build ios fine, but then I ran ionic emulate ios and it brought up the xcode emulator but with no app or button for my app (just safari, maps, etc.).
I then later ran ionic emulate ios --target="iPhone-5s" and got this error:
BUILD SUCCEEDED
An error was encountered processing the command
(domain=com.apple.CoreSimulator.SimError, code=159): Invalid device
state An error was encountered processing the command
(domain=com.apple.CoreSimulator.SimError, code=159): Invalid device
state
ENOENT: no such file or directory, stat
'/Users/sh/Library/Logs/CoreSimulator/62773263-27DC-4E83-9C6A-ED2B73DC3F0A/system.log'
Error code 1 for command: ios-sim with args:
launch,/Users/sh/Desktop/shapp/platforms/ios/build/emulator/shapp.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-5s,--stderr,/Users/sh/Desktop/shapp/platforms/ios/cordova/console.log,--stdout,/Users/sh/Desktop/shapp/platforms/ios/cordova/console.log,--exit
Error: /Users/sh/Desktop/shapp/platforms/ios/cordova/run: Command
failed with exit code 2
SHs-iMac:shapp sh$ q
-bash: q: command not found
Not sure what I did wrong as I added and built ios correctly.
It also worked correctly when pulled up in xcode although there are these warnings for both running with 5s and 6. I think it is an ionic issue not being able to emulate ios just not sure how to fix it?
Do this:
Update ios-sim package: npm install ios-sim -g
Update cordova: npm install -g cordova
Remove iOS platform: ionic platform rm ios
Add iOS platform: ionic platform add ios

New to ionic - can’t build for ios (9) on El Capitan, and sudo ionic is required, deprecated npmconf

I am a student and I just started with ionic today. I have no experience with command line usage so I am pretty stumped here.
When I try to run the basic template (tabs) with:
sudo ionic platform add ios
sudo ionic build ios
sudo ionic emulate ios
(these don't work without having the sudo there).
the last one produces this in the logs (among other stuff above):
** BUILD SUCCEEDED **
No target specified for emulator. Deploying to iPhone-6 simulator
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
ENOENT: no such file or directory, stat '/Users/Dylan/Library/Logs/CoreSimulator/D0923A6C-7738-41BA-8134-ED747069991A/system.log'
Error code 1 for command: ios-sim with args: launch,/Users/Dylan/myApp/platforms/ios/build/emulator/myApp.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-6,--stderr,/Users/Dylan/myApp/platforms/ios/cordova/console.log,--stdout,/Users/Dylan/myApp/platforms/ios/cordova/console.log,--exit
Error: /Users/Dylan/myApp/platforms/ios/cordova/run: Command failed with exit code 2
I have seen a few unsolved posts with the same errors but they haven't gotten anywhere. It could possibly be related to these following things here:
When running sudo npm install -g cordova ionic I get this warning:
npm WARN deprecated npmconf#2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
Also, afterwards, if I try to run ionic I get a -bash: ionic: command not found error, but if I run sudo ionic then it logs a whole bunch of stuff to the console. Could this one be an error with security changes in El Capitan?
Thanks for your help in advance.
To prevent having to sudo almost anything you do in npm while working on MAC, my best advice is:
Install npm through Node Version Manager.

Ionic ios app Build failed MainController.xib

Sometimes when i try to build my ios project on xcode i get the following error
The following build commands failed:
CompileXIB ProjectName/Classes/MainViewController.xib
Error code 65 for command: xcodebuild with args: -xcconfig,/Users/ritesh/Documents/Projects/test-app/platforms/ios/cordova/build-debug.xcconfig,-project,ProjectName.xcodeproj,ARCHS=i386,-target,ProjectName,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/ritesh/Documents/Projects/test-app/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/ritesh/Documents/Projects/test-app/platforms/ios/build/sharedpch
ERROR building one of the platforms: Error: /Users/ritesh/Documents/Projects/test-app/platforms/ios/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /Users/ritesh/Documents/Projects/test-app/platforms/ios/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
I read this bolog post and while his suggestion makes sense but I dont have a duplicate of the file which he said i should see when i open my .pbxproj file.
https://medium.com/#_qzapaia/cordova-ionic-ios-build-error-697a7ec5b46#.snruarnmz
if i build my project for the second time, it builds properly so im not sure what is causing this occasionally. Any clues from anyone?
Cheers
Run (this will remove the old ionic ios platform)
sudo ionic platform rm ios
Then (this will install a new platform with privileges)
sudo ionic platform add ios
Then build your code ios/android
ionic build ios
ionic build android
This fixed it for me!
I was having this same problem for like three days, and I just solved it for myself. My issue was that I was using Xcode 7.1, and apparently there's something about that version that was causing the compiler issue.
Solution:
I uninstalled Xcode 7.1 by deleting the app from my Applications folder.
I went to this page and downloaded Xcode 6.4 instead.
After downgrading to Xcode 6.4, I was able to build for ios without an issue.

ENOENT error when trying to emulate Ionic made iOS app

I am trying the Ionic framework.Everything ran smoothly but
when I tried to emulate an iOS app
macbook$ sudo ionic emulate ios
I got the following error:
Password:
....
** BUILD SUCCEEDED **
No target specified for emulator. Deploying to iPhone-6 simulator
ENOENT, no such file or directory '/Users/macbook/Library/Logs/CoreSimulator/9F89ED64-0748-4A65-92DF-611110E9D4C4/system.log'
Error code 1 for command: ios-sim with args: launch,/Users/macbook/Documents/workspaceionic/MyTestApp/platforms/ios/build/emulator/MyTestApp.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-6,--stderr,/Users/macbook/Documents/workspaceionic/MyTestApp/platforms/ios/cordova/console.log,--stdout,/Users/macbook/Documents/workspaceionic/MyTestApp/platforms/ios/cordova/console.log,--exit
Error: /Users/macbook/Documents/workspaceionic/MyTestApp/platforms/ios/cordova/run: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Process.ChildProcess._handle.onexit (child_process.js:802:5)
do you have any ideas about what could be wrong?
I'm using Yosemite and Node version is 0.12.7. iOS apps from XCode emulate fine
EDIT:
if I open the project with XCode and emulate it, it works.
no need for sudo
ionic emulate iOS
is the correct statement
There are apparently issues with running Node 0.12.x and Ionic. I'm running into this issue, myself, in my c9.io account... the dev environ wants 0.12.x, but Ionic requires 0.10.x. See Anil Singh's response in this thread for more information: With Node 0.12.2 and npm 2.7.4 ionic installation error on windows 7
It's a permission issue, it's resolve my problem,
sudo chown -R $(whoami) ~/Code/ionic-app/

Resources