Robin Timman
Robin Timman

Reputation: 519

Error trying to install ios-deploy

I am using the ionic framework but when I want to run my app on a device I need to install ios-deploy, but when I try to install that, I get the following error when I run

npm install -g ios-deploy

This is the error:

> [email protected] preinstall /usr/local/lib/node_modules/ios-deploy
> make ios-deploy

gcc -ObjC -g -o ios-deploy -framework Foundation -framework CoreFoundation -framework MobileDevice -F/System/Library/PrivateFrameworks ios-deploy.c
In file included from ios-deploy.c:4:
In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10:
In file included from /System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:6:
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:7:15: error: expected ';' after @class
@class NSArray<ObjectType>;
              ^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:7:16: error: cannot find protocol declaration for 'ObjectType'
@class NSArray<ObjectType>;
               ^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:34:25: error: cannot find protocol declaration for 'ObjectType'
@interface NSEnumerator<ObjectType> : NSObject <NSFastEnumeration>
                        ^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:34:37: error: expected identifier or '('
@interface NSEnumerator<ObjectType> : NSObject <NSFastEnumeration>
                                    ^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:36:13: error: expected ')'
- (nullable ObjectType)nextObject;
            ^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:36:3: note: to match this '('
- (nullable ObjectType)nextObject;
  ^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:40:25: error: cannot find protocol declaration for 'ObjectType'
@interface NSEnumerator<ObjectType> (NSExtendedEnumerator)
                        ^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:40:1: error: duplicate interface definition for class 'NSEnumerator'
@interface NSEnumerator<ObjectType> (NSExtendedEnumerator)
^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:34:12: note: previous definition is here
@interface NSEnumerator<ObjectType> : NSObject <NSFastEnumeration>
           ^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:40:37: error: method type specifier must start with '-' or '+'
@interface NSEnumerator<ObjectType> (NSExtendedEnumerator)
                                    ^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:40:38: error: expected a type
@interface NSEnumerator<ObjectType> (NSExtendedEnumerator)
                                     ^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:1: error: expected selector for Objective-C method
@property (readonly, copy) NSArray<ObjectType> *allObjects;
^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:36: error: cannot find protocol declaration for 'ObjectType'
@property (readonly, copy) NSArray<ObjectType> *allObjects;
                                   ^
In file included from ios-deploy.c:4:
In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10:
/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:16:32: error: cannot find protocol declaration for 'ObjectType'
@interface NSArray<__covariant ObjectType> : NSObject <NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration>
                               ^
/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:16:44: error: expected identifier or '('
@interface NSArray<__covariant ObjectType> : NSObject <NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration>
                                           ^
/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:19:4: error: expected a type
- (ObjectType)objectAtIndex:(NSUInteger)index;
   ^
/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:21:40: error: expected ')'
- (instancetype)initWithObjects:(const ObjectType [])objects count:(NSUInteger)cnt NS_DESIGNATED_INITIALIZER;
                                       ^
/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:21:33: note: to match this '('
- (instancetype)initWithObjects:(const ObjectType [])objects count:(NSUInteger)cnt NS_DESIGNATED_INITIALIZER;
                                ^
/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:26:20: error: cannot find protocol declaration for 'ObjectType'
@interface NSArray<ObjectType> (NSExtendedArray)
                   ^
/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:26:1: error: duplicate interface definition for class 'NSArray'
@interface NSArray<ObjectType> (NSExtendedArray)
^
/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:16:12: note: previous definition is here
@interface NSArray<__covariant ObjectType> : NSObject <NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration>
           ^
/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:26:32: error: method type specifier must start with '-' or '+'
@interface NSArray<ObjectType> (NSExtendedArray)
                               ^
/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:26:33: error: expected a type
@interface NSArray<ObjectType> (NSExtendedArray)
                                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [ios-deploy] Error 1
npm ERR! Darwin 15.0.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "ios-deploy"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1
npm ERR! code ELIFECYCLE

npm ERR! [email protected] preinstall: `make ios-deploy`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] preinstall script 'make ios-deploy'.
npm ERR! This is most likely a problem with the ios-deploy package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     make ios-deploy
npm ERR! You can get their info via:
npm ERR!     npm owner ls ios-deploy
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Robin/npm-debug.log

How can I fix this error?

Upvotes: 2

Views: 1506

Answers (4)

demosp
demosp

Reputation: 23

A manual installation might be easier:

  • Clone/download the https://github.com/phonegap/ios-deploy
  • Launch ios-deploy.xcodeproj in Xcode
  • Select the ios-deploy target and build
  • The location of the built product is printed in the console (e.g. mine was Usage: ~/Library/Developer/Xcode/DerivedData/ios-deploy-gkspgoqhykoeszgvalmlquqrkuom/Build/Products/Debug/ios-deploy)
  • For ease of use copy ios-deploy in /usr/local/bin

You should now be able to use it from Terminal as normal.

Upvotes: 0

陈宏辉
陈宏辉

Reputation: 41

I've had the same problem. Then I find he's answer solve my problem. answer bring ios-deploy alive

Just try:

npm install -g ios-deploy --unsafe-perm=true

Upvotes: 3

Patrick Fowler
Patrick Fowler

Reputation: 176

This issue is being tracked in the phonegap/ios-deploy repository as Issue #161. In most cases, the problem is caused by running or installing Xcode 7 Beta. In summary, it seems that the command line tools and the project compile settings get out of sync, leading to the wrong version of the libraries being linked, and this problem surfacing.

The best bet for a solution can be found in a comment by cyberwisdom. In summary:

  1. Go into Xcode preferences and check the version set for Command Line Tools.
  2. From the Terminal, run xcodebuild -version
  3. Confirm that the two versions are in sync with one another. Adjust the version in Xcode as necessary.
  4. Link the dynamic library location using the following: cd /Applications/Xcode-beta.app (or wherever your Xcode 7 beta is located) cd Contents/Developer/Platforms/iPhoneSimulator.platform cd Developer/SDKs/iPhoneSimulator.sdk/usr/lib sudo mv dyld_sim dyld_sim.rig

This worked for me, YMMV

Upvotes: 0

jjj05555
jjj05555

Reputation: 25

Have you tried it with sudo command? I have always this problem when i don't use sudo

sudo npm install -g ios-deploy

Upvotes: 0

Related Questions