react-native run-ios只会产生一大堆错误 - 如何调试

时间:2017-01-13 15:52:21

标签: react-native

我决定重新开始一个新的react-native项目,所以我将react-client更新到最新版本2.0,更新了cocoapods到最新版本,我刚刚初始化了一个空白的反应本机项目,yarn添加了一堆依赖项react-native链接没有错误然后尝试运行并得到一大堆错误。我错过了一些非常明显的东西吗?

步骤:

react-native init Foo && cd Foo
yarn add react-dom 
yarn add react-apollo
yarn add @shoutem/ui 
yarn add apollo-client@^0.6.0 
yarn add react-dom redux 
yarn add react-redux 
yarn add redux-thunk 
yarn add bluebird 
yarn add redux-actions 
yarn add react-native-lock 
yarn add redux-persist
react-native link
react-native run-ios

错误:

=== BUILD TARGET RNVectorIcons OF PROJECT RNVectorIcons WITH CONFIGURATION Debug ===


Check dependencies



CompileC /Users/mycomputer/Projects/Foo/ios/build/Build/Intermediates/RNVectorIcons.build/Debug-iphonesimulator/RNVectorIcons.build/Objects-normal/x86_64/RNVectorIconsManager.o RNVectorIconsManager/RNVectorIconsManager.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons
    export LANG=en_US.US-ASCII
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/mycomputer/.dnx/runtimes/dnx-coreclr-darwin-x64.1.0.0-rc1-update1/bin:/Users/mycomputer/.dnx/bin:/usr/local/heroku/bin:/Applications/sdk/platform-tools:/Applications/sdk/tools:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:/Library/Frameworks/Mono.framework/Versions/Current/Commands"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-cache-path=/Users/mycomputer/Projects/Foo/ios/build/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/mycomputer/Projects/Foo/ios/build/ModuleCache/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DDEBUG=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -mios-simulator-version-min=7.0 -g -Wno-sign-conversion -Wno-infinite-recursion -fobjc-abi-version=2 -fobjc-legacy-dispatch -iquote /Users/mycomputer/Projects/Foo/ios/build/Build/Intermediates/RNVectorIcons.build/Debug-iphonesimulator/RNVectorIcons.build/RNVectorIcons-generated-files.hmap -I/Users/mycomputer/Projects/Foo/ios/build/Build/Intermediates/RNVectorIcons.build/Debug-iphonesimulator/RNVectorIcons.build/RNVectorIcons-own-target-headers.hmap -I/Users/mycomputer/Projects/Foo/ios/build/Build/Intermediates/RNVectorIcons.build/Debug-iphonesimulator/RNVectorIcons.build/RNVectorIcons-all-target-headers.hmap -iquote /Users/mycomputer/Projects/Foo/ios/build/Build/Intermediates/RNVectorIcons.build/Debug-iphonesimulator/RNVectorIcons.build/RNVectorIcons-project-headers.hmap -I/Users/mycomputer/Projects/Foo/ios/build/Build/Products/Debug-iphonesimulator/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/../../React -I../react-native/React -I../react-native/React/Base -I../react-native/React/CSSLayout -I../react-native/React/Executors -I../react-native/React/Modules -I../react-native/React/Profiler -I../react-native/React/Views -I/Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/node_modules/react-native/React -I/Users/mycomputer/Projects/Foo/ios/build/Build/Intermediates/RNVectorIcons.build/Debug-iphonesimulator/RNVectorIcons.build/DerivedSources/x86_64 -I/Users/mycomputer/Projects/Foo/ios/build/Build/Intermediates/RNVectorIcons.build/Debug-iphonesimulator/RNVectorIcons.build/DerivedSources -F/Users/mycomputer/Projects/Foo/ios/build/Build/Products/Debug-iphonesimulator -MMD -MT dependencies -MF /Users/mycomputer/Projects/Foo/ios/build/Build/Intermediates/RNVectorIcons.build/Debug-iphonesimulator/RNVectorIcons.build/Objects-normal/x86_64/RNVectorIconsManager.d --serialize-diagnostics /Users/mycomputer/Projects/Foo/ios/build/Build/Intermediates/RNVectorIcons.build/Debug-iphonesimulator/RNVectorIcons.build/Objects-normal/x86_64/RNVectorIconsManager.dia -c /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m -o /Users/mycomputer/Projects/Foo/ios/build/Build/Intermediates/RNVectorIcons.build/Debug-iphonesimulator/RNVectorIcons.build/Objects-normal/x86_64/RNVectorIconsManager.o

In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m:10:
In file included from ../react-native/React/Base/RCTConvert.h:17:
/Users/mycomputer/Projects/Foo/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTLog.h:40:28: error: redefinition of 'RCTLogLevel'
typedef NS_ENUM(NSInteger, RCTLogLevel) {
                           ^
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m:9:
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.h:10:
../react-native/React/Base/RCTLog.h:40:28: note: previous definition is here
typedef NS_ENUM(NSInteger, RCTLogLevel) {
                           ^
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m:10:
In file included from ../react-native/React/Base/RCTConvert.h:17:
/Users/mycomputer/Projects/Foo/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTLog.h:41:3: error: redefinition of enumerator 'RCTLogLevelTrace'
  RCTLogLevelTrace = 0,
  ^
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m:9:
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.h:10:
../react-native/React/Base/RCTLog.h:41:3: note: previous definition is here
  RCTLogLevelTrace = 0,
  ^
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m:10:
In file included from ../react-native/React/Base/RCTConvert.h:17:
/Users/mycomputer/Projects/Foo/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTLog.h:42:3: error: redefinition of enumerator 'RCTLogLevelInfo'
  RCTLogLevelInfo = 1,
  ^
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m:9:
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.h:10:
../react-native/React/Base/RCTLog.h:42:3: note: previous definition is here
  RCTLogLevelInfo = 1,
  ^
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m:10:
In file included from ../react-native/React/Base/RCTConvert.h:17:
/Users/mycomputer/Projects/Foo/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTLog.h:43:3: error: redefinition of enumerator 'RCTLogLevelWarning'
  RCTLogLevelWarning = 2,
  ^
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m:9:
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.h:10:
../react-native/React/Base/RCTLog.h:43:3: note: previous definition is here
  RCTLogLevelWarning = 2,
  ^
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m:10:
In file included from ../react-native/React/Base/RCTConvert.h:17:
/Users/mycomputer/Projects/Foo/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTLog.h:44:3: error: redefinition of enumerator 'RCTLogLevelError'
  RCTLogLevelError = 3,
  ^
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m:9:
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.h:10:
../react-native/React/Base/RCTLog.h:44:3: note: previous definition is here
  RCTLogLevelError = 3,
  ^
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m:10:
In file included from ../react-native/React/Base/RCTConvert.h:17:
/Users/mycomputer/Projects/Foo/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTLog.h:45:3: error: redefinition of enumerator 'RCTLogLevelFatal'
  RCTLogLevelFatal = 4
  ^
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m:9:
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.h:10:
../react-native/React/Base/RCTLog.h:45:3: note: previous definition is here
  RCTLogLevelFatal = 4
  ^
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m:10:
In file included from ../react-native/React/Base/RCTConvert.h:17:
/Users/mycomputer/Projects/Foo/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTLog.h:51:28: error: redefinition of 'RCTLogSource'
typedef NS_ENUM(NSInteger, RCTLogSource) {
                           ^
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m:9:
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.h:10:
../react-native/React/Base/RCTLog.h:51:28: note: previous definition is here
typedef NS_ENUM(NSInteger, RCTLogSource) {
                           ^
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m:10:
In file included from ../react-native/React/Base/RCTConvert.h:17:
/Users/mycomputer/Projects/Foo/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTLog.h:52:3: error: redefinition of enumerator 'RCTLogSourceNative'
  RCTLogSourceNative = 1,
  ^
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m:9:
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.h:10:
../react-native/React/Base/RCTLog.h:52:3: note: previous definition is here
  RCTLogSourceNative = 1,
  ^
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m:10:
In file included from ../react-native/React/Base/RCTConvert.h:17:
/Users/mycomputer/Projects/Foo/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTLog.h:53:3: error: redefinition of enumerator 'RCTLogSourceJavaScript'
  RCTLogSourceJavaScript = 2
  ^
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m:9:
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.h:10:
../react-native/React/Base/RCTLog.h:53:3: note: previous definition is here
  RCTLogSourceJavaScript = 2
  ^
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m:11:
In file included from ../react-native/React/Base/RCTBridge.h:13:
/Users/mycomputer/Projects/Foo/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridgeModule.h:55:11: warning: duplicate protocol definition of 'RCTBridgeModule' is ignored
@protocol RCTBridgeModule <NSObject>
          ^
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.m:9:
In file included from /Users/mycomputer/Projects/Foo/node_modules/react-native-vector-icons/RNVectorIconsManager/RNVectorIconsManager.h:9:
../react-native/React/Base/RCTBridgeModule.h:55:11: note: previous definition is here
@protocol RCTBridgeModule <NSObject>
          ^
1 warning and 9 errors generated.



** BUILD FAILED **


The following build commands failed:

    CompileC /Users/mycomputer/Projects/Foo/ios/build/Build/Intermediates/RNVectorIcons.build/Debug-iphonesimulator/RNVectorIcons.build/Objects-normal/x86_64/RNVectorIconsManager.o RNVectorIconsManager/RNVectorIconsManager.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Installing build/Build/Products/Debug-iphonesimulator/Foo.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/Foo.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

1 个答案:

答案 0 :(得分:3)

如果您运行的是React Native 0.40(运行react-native --version),则需要安装最新的&#39; react-native-vector-icons&#39;由于breaking change for iOS native headers

在&#39; shoutem / ui&#39; package.json,由于semver定义(^ 2.0.3只能安装到v2.1.0),因此不会安装最新版本。

尝试执行以下操作来解决问题:

  1. 使用yarn remove react-native-vector-icons卸载react-native-vector-icons。
  2. 使用yarn add react-native-vector-icons重新安装。
  3. 运行react-native link以将lib依赖项链接回Xcode项目。
  4. 如果他们依赖iOS本机标头,您可能也会遇到与其他库类似的问题。希望他们能够发布一个新版本来解决这个问题。 (修复方法是更新标头导入声明,例如从#import "RCTUtils.h"更新为#import <React/RCTUtils.h>

    PS:如果您不是迫切需要RN 0.40,请尝试通过运行react-native init yourProjectName --version 0.39.2来使用v0.40初始化您的项目,这样您就可以继续工作而无需等待相应的库来修复它。 / p>