从 github 打开 react-native 项目时构建失败

Posted

技术标签:

【中文标题】从 github 打开 react-native 项目时构建失败【英文标题】:Build failed while opening a react-native project from github 【发布时间】:2019-08-09 11:57:28 【问题描述】:

我已经从 github 下载了 react-native 项目。链接是here

我安装了 npm。到目前为止一切都很好。当我运行 react-native run-ios 时出现以下错误

命令行中的用户默认值: IDEDerivedDataPathOverride = /Users/sriram/Desktop/FirebaseAuth-master/ios/build/Auth

注意:使用新的构建系统 注:规划建设 注意:构建构建描述 构建系统信息 错误:/Users/sriram/Desktop/FirebaseAuth-master/ios/Pods/Target Support Files/Pods-Auth/Pods-Auth.debug.xcconfig:无法打开文件(在项目“Auth”中的目标“Auth”中)(在目标“身份验证”中)

构建系统信息 错误:/Users/sriram/Desktop/FirebaseAuth-master/ios/Pods/Target Support Files/Pods-Auth/Pods-Auth.debug.xcconfig:无法打开文件(在项目“Auth”中的目标“Auth”中)(在目标“身份验证”中)

构建系统信息 错误:/Users/sriram/Desktop/FirebaseAuth-master/ios/Pods/Target Support Files/Pods-Auth/Pods-Auth.debug.xcconfig:无法打开文件(在项目“Auth”中的目标“Auth”中)(在目标“身份验证”中)

构建系统信息 错误:/Users/sriram/Desktop/FirebaseAuth-master/ios/Pods/Target Support Files/Pods-Auth/Pods-Auth.debug.xcconfig:无法打开文件(在项目“Auth”中的目标“Auth”中)(在目标“身份验证”中)

构建系统信息 错误:/Users/sriram/Desktop/FirebaseAuth-master/ios/Pods/Target Support Files/Pods-AuthTests/Pods-AuthTests.debug.xcconfig:无法打开文件(在项目“Auth”中的目标“AuthTests”中)(在目标“AuthTests”中)

构建系统信息 错误:/Users/sriram/Desktop/FirebaseAuth-master/ios/Pods/Target Support Files/Pods-AuthTests/Pods-AuthTests.debug.xcconfig:无法打开文件(在项目“Auth”中的目标“AuthTests”中)(在目标“AuthTests”中)

构建系统信息 错误:/Users/sriram/Desktop/FirebaseAuth-master/ios/Pods/Target Support Files/Pods-AuthTests/Pods-AuthTests.debug.xcconfig:无法打开文件(在项目“Auth”中的目标“AuthTests”中)(在目标“AuthTests”中)

构建系统信息 错误:/Users/sriram/Desktop/FirebaseAuth-master/ios/Pods/Target Support Files/Pods-AuthTests/Pods-AuthTests.debug.xcconfig:无法打开文件(在项目“Auth”中的目标“AuthTests”中)(在目标“AuthTests”中)

** 构建失败 **

后来我尝试了cd ios && pod install 之后我尝试了react-native run-ios, 我收到以下错误: 以下构建命令失败: CompileC /Users/sriram/Desktop/Auth/ios/build/Auth/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/DoubleConversion.build/Objects-normal/x86_64/DoubleConversion-dummy.o Target\ Support\ Files /DoubleConversion/DoubleConversion-dummy.m 正常 x86_64 目标-c com.apple.compilers.llvm.clang.1_0.compiler (1 次失败)

这是我的 PodFile:

platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'Auth' do
  # Pods for Auth
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/React'
  pod 'React-DevSupport', :path => '../node_modules/react-native/React'
  pod 'React-fishhook', :path => '../node_modules/react-native/Libraries/fishhook'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  target 'AuthTests' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!
end

target 'Auth-tvOS' do
  # Pods for Auth-tvOS

  target 'Auth-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

【问题讨论】:

进入ios文件夹并执行pod install 我尝试了 pod install,现在我正在 Metro bundler 终端中获得关注。 /Users/sriram/Desktop/FirebaseAuth-master/node_modules/react-native/scripts/launchPackager.command;出口; (基础)srirams-Mac:~ sriram$ /Users/sriram/Desktop/FirebaseAuth-master/node_modules/react-native/scripts/launchPackager.command ;退出; 而且我在模拟器中也没有找到捆绑 URL 是gitignore文件的问题吗? 你能用正确的错误更新你的帖子,并发布你的Podfile 【参考方案1】:

按照以下步骤操作:

    打开Auth.xcworkspace

    在左侧,您会找到Pods 文件夹。删除它。

    现在在终端中,进入您的项目目录,cd 进入 ios 并执行rm -rf Pods Podfile.lock

    pod install

【讨论】:

我已经完成了您在此处列出的所有操作,但是 Metro 捆绑程序卡在加载依赖关系图上,并且在 iphone 模拟器中说没有捆绑 URL 存在 能否请您指定 .gitignore 文件中的所有内容,这样我就不会再遇到这个问题了 @sriramhegde 现在在建吗? 是的,它的构建,但是在 Metro bundler 中,它卡在加载依赖图上 @sriramhegde 你能推送你的更改,以便我可以克隆并重试吗?

以上是关于从 github 打开 react-native 项目时构建失败的主要内容,如果未能解决你的问题,请参考以下文章

React-native:打开表情符号键盘

iOS 上的共享扩展无法打开我的 react-native 应用

react-native 真机调试的跨域问题

react-native开发总结

react-native android模拟器或真机上定时器setInterval和setTimeout失效

如何在 IOS 中从我的 React-Native 应用程序打开外部应用程序?