diegonetto / generator-ionic

Build hybrid mobile apps using the Ionic Framework
MIT License
1.74k stars 336 forks source link

Error executing grunt platform:add:ios on Windows #183

Open ryaa opened 9 years ago

ryaa commented 9 years ago

Below is the error when I try to execute grunt platform:add:ios on Windows

PS C:\Git\SmartMeteoMobileApp\src> grunt platform:add:ios Running "platform:add:ios" (platform) task Creating ios project...

Error: C:\Users\alex.cordova\lib\ios\cordova\3.4.1\bin\create: Command failed with exit code ENOENT at ChildProcess.whenDone (C:\Git\SmartMeteoMobileApp\src\node_modules\cordova\src\superspawn.js:126:23) at ChildProcess.emit (events.js:95:17) at Process.ChildProcess._handle.onexit (child_process.js:808:12) Warning: Task "platform:add:ios" failed. Use --force to continue.

Aborted due to warnings.

Execution Time (2015-03-28 06:40:00 UTC) loading tasks 13ms ■■ 1% platform:add:ios 1s ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 99% Total 1s

kzsolti commented 9 years ago

Yup, that's about what's expected, unfortunately! The only platform you can develop iOS apps on, even when using a Cordova based framework, is OS X. Cordova requires Xcode command line tools to do the business, so you won't even be able to add the platform on a Windows machine.

See the relevant Cordova platform documentation: http://cordova.apache.org/docs/en/4.0.0/guide_platforms_ios_index.md.html#iOS%20Platform%20Guide

Sorry!

ryaa commented 9 years ago

It does not work on MacOS as well

Alexs-MacBook-Pro:src alex$ grunt platform:add:ios Running "platform:add:ios" (platform) task

/Volumes/BOOTCAMP/Git/SmartMeteoMobileApp/src/node_modules/cordova/bin/cordova.cmd: line 1: @node: command not found Warning: Task "platform:add:ios" failed. Use --force to continue.

Aborted due to warnings.

Execution Time (2015-03-28 08:04:00 UTC) loading tasks 59ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 69% platform:add:ios 26ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 30% Total 86ms

ryaa commented 9 years ago

I'm wondering why it uses cmd on MacOS

kzsolti commented 9 years ago

Okay, but this time you got a different error! And you're right, it really shouldn't use the .cmd binary...

As far as can see, the grunt script determines which binary to use based on the process.platform nodejs global variable. If that says your platform is win32, then you get the .cmd commands, otherwise it goes with the linux variant. I'm guessing it might be wrong for you, because you have the project under a bootcamp folder. You could try running node -e 'console.log(process.platform)' in there to see if that's the case. You could also try cloning your repo under OS X, and seeing if you get the same problem there.

ryaa commented 9 years ago

running node -e 'console.log(process.platform)' seems to show correct result - see below

Alexs-MacBook-Pro:src alex$ node -e 'console.log(process.platform)' darwin

kzsolti commented 9 years ago

Well, bummer... Sorry, I'm out of ideas then.

ryaa commented 9 years ago

I could not make grunt platform:add:ios to work. However cordova platform add ios worked fine

Alexs-MacBook-Pro:src alex$ cordova platform add ios Adding ios project... iOS project created with cordova-ios@3.8.0 Installing "com.megster.cordova.bluetoothserial" for ios Installing "org.apache.cordova.device" for ios

emj365 commented 9 years ago

grunt build:ios or grunt build:android those will not work on my Mac.

What the reason to wrap the build command with the grunt? Or just remove them if they won't work correctly.