UnhandledPromiseRejectionWarning: xcodebuild was not found - ios

Recently I created an app in ionic and I wanted to test it in ios. So I run the command ionic cordova emulate ios . But, It is giving me following error.
(node:4200) UnhandledPromiseRejectionWarning: xcodebuild was not found. Please install version 7.0.0 or greater from App Store
I also run following commands but it still shows same error.
npm install -g ios-sim
and
npm install -g ios-deploy
Please guide me what to do.
NOTE: I am using Ubuntu 16.04

You are getting an error because you are running this command on Linux you need macOS to run this command. Hope this will help you :)

Related

React native runnig error on ios device

I am trying to run react native code to iphone, however it shows the following message.
The following code runs on Android normally, and on expo fine too, but it does not run on physical device.
Please help me.
E:\reactnative\cd webview
E:\reactnative\webview>react-native run-ios
Scanning folders for symlinks in E:\reactnative\webview\node_modules (38ms)
Found Xcode project webview.xcodeproj
spawnSync xcrun ENOENT
E:\reactnative\webview>
If you are using react-native-cli version 0.1.7 then you could either
Rollback to 0.1.7 (do not use '--verbose' argument)
npm install -g react-native-cli#0.1.7
or try it with the latest which might be fixed
npm uninstall -g react-native-cli
npm install -g react-native-cli
There was a regression in 0.1.8, reported here: https://github.com/facebook/react-native/issues/5169

You may not have the required environment or OS to run this project - Cordova - iOS

I'm working with Cordova to build my mobile app. I'm working on a Mac machine and when I try to build and run my app on iOS device, but I'm keep getting this error.
When running:
cordova build ios
output:
** BUILD SUCCEEDED **
then I run
cordova run ios
I get the error
.../ios/cordova/run: Command failed with exit code 2
You may not have the required environment or OS to run this project
If I try to open the project in Xcode and run it, it successfully run on the device.
I notice that before the run failed, it output the message
ios-sim was not found. Please download, build and install 'npm install -g ios-sim'
I'm guessing Cordova thinks the device isn't plugged in since the ios-sim is a simulatur plugin for cordvoa. But I may be wrong.
Any ideas?
(This question is similar to Cordova: You may not have the required environment or OS to run this project, but this question regarding iOS there that Android)
try
npm install -g ios-sim
npm install -g ios-deploy
I suggest you read iOS Platform guide for more info.

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.

How to run project from Terminal in Ionic + iPhone?

MacBook-Pro:myApps naveenkumar$ ionic run ios
Adding in default Ionic hooks
Running command: /Users/naveenkumar/Documents/ionic_work/myApps/hooks/after_prepare/010_add_platform_class.js /Users/naveenkumar/Documents/ionic_work/myApps
add to body class: platform-ios
Running command: /Users/naveenkumar/Documents/ionic_work/myApps/hooks/after_prepare/020_remove_sass_from_platforms.js /Users/naveenkumar/Documents/ionic_work/myApps
Running command: /Users/naveenkumar/Documents/ionic_work/myApps/platforms/ios/cordova/run
Cordova needs ios-sim version 3.0.0 or greater, you have version 1.9.0
.
ERROR running one or more of the platforms: Error: /Users/naveenkumar/Documents/ionic_work/myApps/platforms/ios/cordova/run: Command failed with exit code 2
You may not have the required environment or OS to run this project
MacBook-Pro:myApps naveenkumar$
Hello,
I am trying to run my project from terminal. I am getting the above error. But when I go to given iOS directory run my project from Xcode it works fine. That means, when I run from Xcode I am able to run emulator /simulator and check my output. But when I run from terminal I am not able to run my application. Could you please tell me how I will run my application from terminal?
Thanks
This is the issue:
Cordova needs ios-sim version 3.0.0 or greater, you have version 1.9.0
Here is the solution:
npm update -g ios-sim
The issue is that you do not have ios-sim installed.
From the ionic framework website, you can see the following statement:
Note: iOS development requires Mac OS X. iOS simulator through the Ionic CLI requires the ios-sim npm package, which can be installed with the command sudo npm -g install ios-sim.
All you need is to install ios-sim by running this command:
sudo npm -g install ios-sim
simctl was not found.
Check that you have Xcode 7.x installed:
xcodebuild --versionCheck that you have Xcode 7.x selected:
xcode-select --print-path

Problems with Getting Started with Ionic OSX

I have a problem when it comes starting with ionic in Mac. I'll explain the steps I have taken and errors I found, to see if anyone can help me.
I installed node.js from this site: nodejs.org
Thereupon I executed these commands:
$ sudo npm install -g cordova ionic cordova
$ ionic start myApp tabs
$ ionic serve
And with this last order I can see the application running. but if I try to do this:
$ sudo ionic platform add ios
I get this error:
But, These are the versions of the programs I use:
cordova - 3.6.3-0.2.13
Ionic - 1.2.7 Xcode - 6.0.1 (6A317)
XAMPP - 1.8.3-3
Someone could help me solve my problem?
Thank you in advance.
The error message says the problem, "Cordova can only run in Xcode version 4.6 or greater."
You need to install Xcode and the Xcode command line tools. Download Xcode from the AppStore, and run this command in the terminal to get the command line tools.
xcode-select --install
Also do not use sudo with the ionic commands. You'll possibly cause permission issues down the road.

Resources