Apache Cordova - cordova platform add iOS failed - ios

I seriously need help in this area. This is my first time working with the iOS platform for apache cordova. I have already downloaded the latest Node.js tool and Apache Cordova on my macbook. The PATH is also set up already. I was following the Apache Cordova command line steps, and when I tried to run the following command:
cordova platform add ios
I received the following error message:
/Users/metanoiasherman/.cordova/lib/npm_cache/cordova-ios/3.7.0/package/bin/create: line 80: dirname: command not found
cat: /Users/metanoiasherman/DropPositioning/../CordovaLib/VERSION: No such file or directory
Error: /Users/metanoiasherman/.cordova/lib/npm_cache/cordova-ios/3.7.0/package/bin/create: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1008:16)
at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
This is what my $PATH prints out in Terminal:
/Users/metanoiasherman/./usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/lib/node_modules/cordova/bin/
Can anyone tell me what I need to do?
I have just downloaded the Xcode command line tools and installed it already. Do I have to restart my macbook? Can someone present me with the steps I need to take to solve this and progress on?

It might be an issue with your $PATH
Try to run
$PATH
from the terminal and check if that includes the same path stated when you run:
which cordova

Related

ionic fails to add iOS platform

when I try the following command in VS Code
sudo ionic cordova platform add iOS
I get an error with the following:
ERROR] An error occurred while running subprocess cordova.
cordova platform add ios exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
I get iOS folder in platforms folder, but how to solve this error ?
First, why are you running with sudo? I would recreate the project in a directory which does not require this. For example ~/dev/myProjectName
Second, when you scroll up it should give a more specific error.
Third, if not have you tried doing as shown and run with --verbose flag?
Fourth, try opening platform/ios project in xCode and running from there. It may give more useful info.

meteor ios cordova ENOET, no such file or director

Hey I started an app with yeomans angular-meteor generator.
Installed Xcode and followed steps to add ios sdk and plataform to my meteor project.
I have tried removing/adding ios platform.
I have tried changing ownership of my meteor project.
But still no luck. Here is the output of the error:
=> App running at: http://localhost:3000/
=> Errors executing Cordova commands:
While running Cordova app for platform iOS with options --emulator:
Error: Command failed:
/Users/donedgardo/marAzul/.meteor/local/cordova- build/platforms/ios/cordova/run --emulator
ENOENT, no such file or directory
'/Users/donedgardo/Library/Logs/CoreSimulator/6EB83B1C-FA07-4728-BE3A-CBA81E4707D1/system.log'
Error code 1 for command: ios-sim with args:
launch,/Users/donedgardo/marAzul/.meteor/local/cordova- build/platforms/ios/build/emulator/marAzul.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-6,--stderr,/Users/donedgardo/marAzul/.meteor/local/cordova-build/platforms/ios/cordova/console.log,--stdout,/Users/donedgardo/marAzul/.meteor/local/cordova-build/platforms/ios/cordova/console.log,--exit
at ChildProcess.exitCallback (/tools/utils/processes.js:137:23)
at ChildProcess.emit (events.js:98:17)
at Process.ChildProcess._handle.onexit (child_process.js:820:12)
ExitWithCode:1
You should chek your mobile-config.js file content. Most or errors are linked to this : maybe your icons or splascreen are not accessible or are in a wrong format (prefer png).
Clean your mobile-config (or use the standard one from meteorJs) and test it.

cant run ios simulator on cordova

On running the command
cordova emulate ios
I get an error, as below. I actually get rm: could not remove & permission denied errors so I use sudo. I was able to run this no problem, and then after a reboot - although nothing was changed - this function does not work. After build succeeded - deploying to emulator I get this error
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/user/Library/Logs/CoreSimulator/8F3C9A0F-D432-49A4-84DA-D0480829884A/system.log'
Error code 1 for command: ios-sim with args: launch,/Users/user/helloworld/platforms/ios/build/emulator/helloworld.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-4s,--stderr,/Users/user/helloworld/platforms/ios/cordova/console.log,--stdout,/Users/user/helloworld/platforms/ios/cordova/console.log,--exit
Error: /Users/user/helloworld/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:139:23)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:818:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
I have reinstalled sudo npm install ios-sim -g and same error. How can I run it properly?
This happens due to the permissions on mac:
Here are the steps you can use to correct this issue:
Empty the 'platforms' folder in your Cordova project.
Re-run Cordova platform add ios, Cordova build ios, and Cordova emulate ios without sudo.
If you are on a Mac and are still getting a permissions error, make sure all the files in your user's home folder actually belong to that user by running sudo chown -R username /Users/username
Its happening when you don't have simulator configurations for the root user.
Following command worked for me
sudo npm install -g ios-sim
If it's not working you can try removing platforms as the root user and add it back as normal user.
This happens because xcode command line tools are not installed in your system
https://github.com/driftyco/ionic/issues/4657.
Do a xcode-select --install from your terminal and reboot the system should work fine.

ERROR building one of the platforms: IOS

Following ionic lessons about up and running mobile hybrid app I was stumbled at step:
$ ionic build ios
the following error is:
$ ionic build ios
Running command: "c:\Program Files (x86)\nodejs\node.exe##c:\wamp\www\weather\hooks\after_prepare\010_add_platform_ class.js c:/wamp/www/weather
add to body class: platform-ios
Running command: cmd "/s/c"c:\wamp\www\weather\platforms\ios\cordova\build""
'c:\wamp\www\weather\platforms\ios\cordova\build' is not recognized as an internal or external command,
operable program or batch file.
ERROR building one of the platforms: Error: cmd: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 1
at ChildProcess.whenDone (c:\Users\Acer\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:139:23)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:817:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
I have no troubles with ionic build android.
Could You help me with some suggestions where the problem come from?
Tnx in advance!
I see you use Windows.
Note: iOS development requires Mac OS X.
Source: http://ionicframework.com/getting-started/
If you really need to build for iOS, you will need to buy a Mac (yeah, this is really sad) or use a solution that handles this kind of case, like Phonegap.
If I remember well, the Ionic team is working on a solution solving this, but it is not yet ready.

Cordova platform add ios - Error Command failed with exit code 2

I am trying to add the iOS platform to my cordova project but I keep coming across the same error. I have followed the instructions here.
When I use cordova platform add ios it gives me the following error
Shauns-MacBook-Pro:hello shaunbrown$ cordova platform add ios
Creating ios project...
Unknown option: n
Usage: head [-options] <url>...
Cordova can only run in Xcode version 4.6 or greater.
Error: /Users/shaunbrown/.cordova/lib/ios/cordova/3.5.0/bin/create: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)
I have tried looking around for the error but I can't find anything.
I am running xCode 5.1.1 so I know it doesn't have anything to do with that. Has anyone else came across this issue, or has a fix for this? I am pulling my hair out trying to fix it and so far I havent got anywhere.
I can provide more information if needed.
I managed to solve this. I opened my .bash_profile file and commented out the line that referred to my XAMPP installation.
I then restarted terminal and it worked perfectly.
You might have Xcode 5.x, but your command line tools are probably set up for a previous version.
Type:
xcodebuild -version
In a terminal. If you need to update, read this:
Xcode 4.4 and later install Command Line Tools

Resources