Ionic-cli: bug: `ionic build ios` not working on Mac OS 10.11

Created on 23 Sep 2015  路  36Comments  路  Source: ionic-team/ionic-cli

_From @stefankp on September 23, 2015 12:24_

Type: bug

Platform: ios 9 webview

ionic build ios does not work anymore, therefore ionic run ios and ionic emulate ios also don't work, meaning I cannot run the app through the ionic CLI. The command runs for a few seconds and then exits without any logs or error messages.

ionic build android still works fine. Building and deploying the app to the simulator or phone works through Xcode.

I am on Mac OS 10.11.1, with Xcode 7 and a complete fresh ionic install.

_Copied from original issue: driftyco/ionic#4414_

old major version

Most helpful comment

ionic state reset did the trick!

All 36 comments

_From @mpm on September 23, 2015 12:42_

I have the same issue :D according to the cordova docs, the build task runs two commands, prepare and compile. The one that breaks (returns without any error message) is

ionic prepare ios

while

ionic compile ios

compiles the stuff that is there (without prepare, the plugins are missing though). I'm trying to understand what the prepare command is doing and it must be somewhere in this repository IMHO, but I couldn't locate it yet.

_From @mpm on September 23, 2015 15:39_

@stefankp and me tracked it down to this line in the xcode npm package. I don't fully understand the fork magic going on there, but the worker object never receives the message message (or whatever is this).

Therefore it can never trigger the error neither the end message, which would finally execute the function in cb (and this function will resolve a promise that resolves a ton of other promises that are currently preventing the ionic prepare build command from succeeding.

So, if anybody knows a bit more about the fork magic going in on the xcode package, please explain where to dig down- where is the message event triggered?

_PS:_
I can build the same project where we spotted the error on a different machine, running the same xcode version but OS X 10.10.5. The problem seems to occur under OS X 10.11.0 and 10.11.1.

_From @mpm on September 23, 2015 16:13_

Alright, we digged down right to the bottom and the short version is:

This issue got fixed in the node-xcode package.

Ionic depends on xcode 0.6.7, so this should be bumped to 0.8.0 (but the 0.8.0 version we got earlier didn't contain this patch yet).

Anyway, everybody having the same issue, just open parseJob.js in your local npm repository and delete the process.exit() in Line 12.

We will post more helpful and proper instructions after we recovered from this exhausting investigation.

(Related: alunny/node-xcode#61).

Still having issues with the plugins missing.

@jasonfutch are these plugins in the project's plugins folder and only missing in the respective platform's plugin subfolder? (after running ionic state reset).

If they are also missing the project's plugin directory, this is probably a different issue. I created a different PR that improves error handling when installing plugins that helps diagnosing missing plugins, maybe that helps.

ionic state reset did the trick!

I was having the same issue, but, I my case I was having issue with cordova-whitelist-plugin, removed the plugin, and re-installed version 1.0 using [email protected] and this fixed the issue for me.

@jasonfutch thanks :) saved me alot of time and effort :)

@mhartington I deleted process.exit() and even updated the rest of the file to reflect all of the changes in the PR but wasn't able to get this to work.

Have you found a new way to get it working since September?

After updated to Mac OS 10.11, I got this problem also (Cannot add platform and build for both ios and android). Finally it was fixed by the following steps (only for my case):

1) Uninstall Node.js v5.0.0 and install then Node.js v0.12.7
2) Reinstall ionic and cordova
3) Run the following command to clear of cache of old version cordova:
$ rm -rf ~/.cordova

For me, it caused of I update my npm to v5.
So reinstall it to v0.12.7 make sense.

where do i find my local parseJob.js. I'm using mac

All - try updating cordova - theres a fix available in Cordova 5.4.0 that fixes issues with Node v5.

npm install -g cordova

Let me know if this helps fix the issues.

thanks jbavari
reinstall cordova solves my problem.

ionic state reset ftw

+1 for ionic state reset

thanks jbavari

ionic state reset plus npm install -g cordova solved this for me. Thanks!

after upgrade cordova cli I face another issue ionic build android not working.

I delete platform dir and run ionic state restore fix android build issue.

@jbavari awesome! I missed the cordova -> node v5 issue, big thanks for your comment!

Reinstalling Cordova fixed this for me too!

Thanks!

@prosenjit-itobuz works exactly as you said following by 'build ios' and 'emulate ios'. Thanks a lot!

+1 for @jbavari
npm install -g cordova fixed it.

I also have the same problem. while i used command
npm install -g cordova
ionic state reset
and also installed the node.js v5 but still ionic build ios and ionic build android did't working on my desktop

Now it is giving me error of
cordova is not recognized as internal or external command
operable program or batch file

how i fix it???

this is view of cmd
324234234

You can not build ios app in windows

this is not showing any version and it has been uninstalled from my system
@prosenjit-itobuz

So you have to install by run npm install -g cordova

Downgraded node to 0.12.7 did it.

I got this problem after upgrading xcode and ionic CLI

solved the problem as follows:

nvm use stable # Now using node v5.0.0 (npm v3.3.6)
npm install -g cordova
ionic state rebuild
# ionic info
Cordova CLI: 6.1.1
Gulp version:  Requiring external module coffee-script/register
Gulp local:   CLI version 3.9.0
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
ios-deploy version: 1.8.2 
ios-sim version: 5.0.3 
OS: Mac OS X El Capitan
Node Version: v5.0.0
Xcode version: Xcode 7.2 Build version 7C68 

updating cordova did the trick for me.

My cordova version was 5.3.3, and the ionic build/run is output nothing.
After I update the cordova version to 6.1.1 and it works.
Thank you

ionic state reset
ionic build ios

Worked for me! 馃憤

I know I am bit late in the party, however, this has stopped working for me again, without any explanation.

My ionic info

Your system information:

Cordova CLI: 7.0.1
Gulp version:  CLI version 1.2.1
Gulp local:  
Ionic Version: 1.2.4-nightly-1917
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
ios-deploy version: 1.9.0 
ios-sim version: 5.0.6 
OS: Mac OS X El Capitan
Node Version: v4.8.3
Xcode version: Xcode 8.1 Build version 8B62 

cordova-ios: 4.4.0

I've the node-xcode : 0.9.3 with following code:

// parsing is slow and blocking right now
// so we do it in a separate process
var fs = require('fs'),
    parser = require('./parser/pbxproj'),
    path = process.argv[2],
    fileContents, obj;

try {
    fileContents = fs.readFileSync(path, 'utf-8');
    obj = parser.parse(fileContents);
    process.send(obj);
} catch (e) {
    process.send(e);
    process.exitCode = 1;
}

Now, when I run

ionic build ios --verbose

it stops mid way after add to body class: platform-ios, on random lines, such as:

In module 'AssetsLibrary' imported from /Users/ravish/Ionic/platforms/ios/CordovaLib/Classes/Public/CDVURLProtocol.m:20:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.1.sdk/System/Library/Frameworks/AssetsLibrary.framework/Headers/ALAssetsLibrary.h:95:1: note: 'assetForURL:resultBlock:failureBlock:' has been explicitly marked deprecated here
- (void)assetForURL:(NSURL *)assetURL resultBlock:(ALAssetsLibraryAssetForURLResultBlock)resultBlock failureBlock:(ALAssetsLibraryAccessFailureBlock)failureBlock NS_DEPRECATED_IOS(4_0, 9_0, "Use fetchAssetsWithLocalIdentifiers:options: on PHAsset to fetch assets by local identifier (or to lookup PHAssets by a previously known ALAssetPropertyAssetURL use fetchAssetsWithALAssetURLs:options:) from the Photos framework instead");
^

and sometimes on this line:

platforms/ios/CordovaLib/Classes/Public/CDVURLProtocol.m:60:9:

the stops at random line numbers.

I tried running:

ionic prepare ios
ionic compile ios

Same result.

I also removed all my plugins to ensure that none them are causing problem, then did this:

ionic state reset
ionic build ios

Still same result, any suggestion?

PS: Build does not fails, it just stops mid way without any error.

Thanks for the issue! This issue appears to be associated with an old version of the Ionic CLI. Please update to the latest CLI version, which supports all versions of the Ionic Framework. If the issue is relevant and if it persists after updating to the latest CLI version, please create a new issue.

Thank you for using Ionic!

Was this page helpful?
0 / 5 - 0 ratings