generator-ionic icon indicating copy to clipboard operation
generator-ionic copied to clipboard

Error executing grunt platform:add:ios on Windows

Open ryaa opened this issue 9 years ago • 8 comments

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

ryaa avatar Mar 28 '15 06:03 ryaa

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!

kzsolti avatar Mar 28 '15 07:03 kzsolti

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 avatar Mar 28 '15 08:03 ryaa

I'm wondering why it uses cmd on MacOS

ryaa avatar Mar 28 '15 08:03 ryaa

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.

kzsolti avatar Mar 28 '15 08:03 kzsolti

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

ryaa avatar Mar 28 '15 08:03 ryaa

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

kzsolti avatar Mar 28 '15 08:03 kzsolti

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 [email protected] Installing "com.megster.cordova.bluetoothserial" for ios Installing "org.apache.cordova.device" for ios

ryaa avatar Mar 28 '15 09:03 ryaa

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.

emj365 avatar Jul 30 '15 13:07 emj365