尝试安装ios-deploy

时间:2015-07-31 22:51:45

标签: macos npm ionic

我正在使用离子框架,但是当我想在设备上运行我的应用程序时,我需要安装ios-deploy,但是当我尝试安装它时,运行时出现以下错误

npm install -g ios-deploy

这是错误:

> ios-deploy@1.7.0 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! ios-deploy@1.7.0 preinstall: `make ios-deploy`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the ios-deploy@1.7.0 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

如何解决此错误?

4 个答案:

答案 0 :(得分:3)

我遇到了同样的问题。然后我发现他的答案解决了我的问题。 answer bring ios-deploy alive

试试:

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

答案 1 :(得分:0)

你用sudo命令试过吗?当我不使用sudo时,我总是遇到这个问题

sudo npm install -g ios-deploy

答案 2 :(得分:0)

此问题在phonegap/ios-deploy存储库中被跟踪为Issue #161。在大多数情况下,问题是由运行或安装Xcode 7 Beta引起的。总之,似乎命令行工具和项目编译设置不同步,导致链接的库的版本错误,并且这个问题浮出水面。

可以找到解决方案的最佳选择in a comment by cyberwisdom。总结:

  1. 进入Xcode首选项并检查命令行工具的版本集。
  2. 在终端上,运行xcodebuild -version
  3. 确认两个版本彼此同步。根据需要调整Xcode中的版本。
  4. 使用以下方法链接动态库位置: 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
  5. 这对我有用,YMMV

答案 3 :(得分:0)

手动安装可能更容易:

  • 克隆/下载https://github.com/phonegap/ios-deploy
  • 在Xcode中启动ios-deploy.xcodeproj
  • 选择ios-deploy目标并构建
  • 构建产品的位置打印在控制台中(例如我的用法:〜/ Library / Developer / Xcode / DerivedData / ios-deploy-gkspgoqhykoeszgvalmlquqrkuom / Build / Products / Debug / ios-deploy
  • 为方便起见,请复制ios-deploy
  • 中的/usr/local/bin

您现在应该可以正常使用终端。