Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhoneGap CLI "cordova build ios" failed

i have created a new hello world project using the following command,

cordova create hello com.example.hello HelloWorld

the project is created successfully, then i add the ios platform by

cordova platform add ios

and to verify i have it added correctly, i type

cordova platform list

the iOS platform is shown in the list. so at this point, according to the PhoneGap tutorial, i can use the command

cordova build ios

to build the iOS version of the project. however, i encounter the following error:

Generating config.xml from defaults for platform "ios"
Preparing ios project
Compiling app on platform "ios" via command "/Users/Aldour/PhoneGap/hello/platforms/ios/cordova/build" 

/usr/local/lib/node_modules/cordova/node_modules/q/q.js:126
                    throw e;
                      ^
Error: An error occurred while building the ios project.
    at ChildProcess.<anonymous> (/usr/local/lib/node_modules/cordova/src/compile.js:65:22)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:735:16)
    at Socket.<anonymous> (child_process.js:948:11)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Pipe.close (net.js:466:12)

the results that i have googled are mostly concerning the android version, talking about the invalid environment path setting. i dont know if it is related since i can create and build a PhoneGap project targeting the android platform without problem.

here is my $PATH:

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin/node:/usr/local/bin/npm:/Developer/SDKs/android-sdk-macosx/platform-tools:/Developer/SDKs/android-sdk-macosx/tools

EDIT: problem solved by re-installing xcode from app store

like image 977
S.C. Avatar asked Dec 05 '22 07:12

S.C.


1 Answers

I had the same problem in Android platform, and it was solved with the commands:

cordova platform rm android
cordova platform add android
cordova build android

in Node.Js console. try it in ios.

If you get an error with 'cordova platform add android', you may need to manually remove any android folders in your project folder hierarchy.

like image 135
Dam Avatar answered Dec 24 '22 05:12

Dam