我刚刚更新到RN v0.63.3。更改应用程序的名称后,我在以前的本机版本上遇到react-native run-ios
的问题,并且项目/方案具有不同的名称,但从未解决该问题,每个人都说只是升级。
现在在v0.63.3上,在react-native run-ios
之后仍然存在构建失败的问题。这次错误是:
**生成失败**
以下构建命令失败: CompileC /用户/vorousjames/Library/Developer/Xcode/DerivedData/
-gdmnlxiprekjqhfiueouiidqhqnl/Build/Intermediates.noindex/ .build/Debug-iphonesimulator/ .build/Objects-normal/x86_64App。 Ø /Users/Desktop/Development/App/iOS/ /AppDelegate.m 普通的x86_64 Objective-c com.apple.compilers.llvm.clang.1_0.compiler (1次失败)
从Xcode内部构建/运行没有问题。仅与react-native run-ios
编辑:我认为自从我刚刚致电react-native run-ios
以来,就已经在全球范围内安装了cli,这可能是一个问题。我相信使用全局安装。因此,自从过时以来,我在全球范围内卸载并尝试将社区软件包与npx react-native run-ios
一起使用。现在它给出了另一个comileC错误,但有所不同。
**生成失败**
以下构建命令失败: CompileC /用户/库/开发人员/Xcode/DerivedData/App-gdmnlxiprekjqhfiueouiidqhqnl/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RNFirebase.build/Objects-normal/x86_64/RNFirebaseMessaging.o /Users/Desktop/Development/App/node_modules/react-native-firebase/ios/RNFirebase/messaging/RNFirebaseMessaging.m 普通的x86_64 Objective-c com.apple.compilers.llvm.clang.1_0.compiler CompileC /用户/库/开发人员/Xcode/DerivedData/App-gdmnlxiprekjqhfiueouiidqhqnl/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RNFirebase.build/Objects-normal/x86_64/RNFirebaseFirestore.o /Users/Desktop/Development/App/node_modules/react-native-firebase/ios/RNFirebase/firestore/RNFirebaseFirestore.m 普通的x86_64 Objective-c com.apple.compilers.llvm.clang.1_0.compiler (2个失败)
这完全扼杀了我快速迭代的能力,欢迎任何建议
反应性:0.63.3 react-native-cli(全局):2.0.1 react-native-community / cli:^ 4.8.0 Xcode:12.0.1 iOS:14.0.1
更新:
package.json:
{
"name": "Aflare",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"@react-native-community/cli": "^4.8.0",
"@react-native-community/clipboard": "^1.2.2",
"algoliasearch": "^3.16.0",
"appcenter": "3.1.1",
"appcenter-analytics": "3.1.1",
"appcenter-crashes": "3.1.1",
"axios": "^0.19.2",
"moment": "^2.24.0",
"moment-timezone": "^0.5.27",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-native": "^0.63.3",
"react-native-agora": "^3.1.3",
"react-native-algolia-dropdown": "^1.6.0",
"react-native-calendars": "^1.220.0",
"react-native-chart-kit": "^4.3.0",
"react-native-code-push": "^6.0.0",
"react-native-extended-stylesheet": "^0.12.0",
"react-native-firebase": "^5.6.0",
"react-native-gesture-handler": "^1.5.2",
"react-native-image-crop-picker": "^0.26.1",
"react-native-material-dropdown": "^0.11.1",
"react-native-reanimated": "^1.4.0",
"react-native-responsive-screen": "^1.4.1",
"react-native-safe-area-context": "^0.6.2",
"react-native-screens": "^1.0.0-alpha.23",
"react-native-snap-carousel": "^3.8.4",
"react-native-splash-screen": "^3.2.0",
"react-native-svg": "^9.13.6",
"react-native-view-shot": "^3.1.2",
"react-native-webview": "^9.4.0",
"react-navigation": "^4.0.2",
"react-navigation-drawer": "^2.3.3",
"react-navigation-stack": "^1.10.3",
"react-redux": "^7.1.3",
"redux": "^4.0.4",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0",
"rn-fetch-blob": "^0.11.2"
},
"devDependencies": {
"@babel/core": "7.8.4",
"@babel/runtime": "7.8.4",
"@react-native-community/eslint-config": "1.1.0",
"@types/react": "^16.9.46",
"@types/react-dom": "^16.9.8",
"babel-jest": "^25.1.0",
"eslint": "6.7.2",
"jest": "^25.1.0",
"metro-react-native-babel-preset": "0.59.0",
"react-test-renderer": "16.13.1"
},
"jest": {
"preset": "react-native"
}
}
在@Florin的建议/过程之后,现在有14个构建错误(来自使用npx react-native run-ios
进行的构建):
**生成失败**
以下构建命令失败: CompileSwift普通x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/Base/BeanCovertor.swift CompileSwift普通x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/Base/Callback.swift CompileSwift普通x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/Base/Extensions.swift CompileSwift普通x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/Base/MediaObserver.swift CompileSwift普通x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/React/PromiseCallback.swift CompileSwift普通x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/React/RCTAgoraRtcChannelModule.swift CompileSwift普通x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/React/RCTAgoraRtcEngineModule.swift CompileSwift普通x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/React/RCTAgoraRtcSurfaceViewManager.swift CompileSwift普通x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/Base/RtcChannel.swift CompileSwift普通x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/Base/RtcChannelEvent.swift CompileSwift普通x86_64 /Users/Desktop/Development/Slide/Slide/node_modules/react-native-agora/ios/RCTAgora/Base/RtcEngine.swift CompileSwift普通x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/Base/RtcEngineEvent.swift CompileSwift普通x86_64 /Users/Desktop/Development/App/node_modules/react-native-agora/ios/RCTAgora/Base/RtcSurfaceView.swift CompileC /用户/库/开发人员/Xcode/DerivedData/
-gdmnlxiprekjqhfiueouiidqhqnl/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RNFirebase.build/Objects-normal/x86_64/RNFirebaseMessaging.o /Users/Desktop/Development/App/node_modules/react-native-firebase/ios/RNFirebase/messaging/RNFirebaseMessaging.m 普通的x86_64 Objective-c com.apple.compilers.llvm.clang.1_0.compiler (14次失败)
完整的构建输出(在粘胶的终端中返回)在这里:https://pastebin.com/XenEszNe
答案 0 :(得分:3)
在大多数情况下,当我从控制台版本和Xcode版本中获得不同的输出时,我怀疑存在缓存问题,因此我使用了以下步骤来解决该问题:
pod install
npx watchman watch-del-all && yarn start --reset-cache
这时,两个命令的输出应该相同。如果遇到错误 仔细阅读整个错误消息,有很多机会注意到错误日志中隐藏的模块存在问题。
仔细查看您的错误消息,看起来与衍生数据/缓存或某些未更新的pod相关。
如果您仍然遇到问题,请附上您的问题:
package.json
内容,bundle react-native code and images
脚本的内容。更新:
如果升级到0.63.3之后,您发现许多与React依赖项有关的问题,请确保pod文件是干净的,并且仅包含您的特殊依赖项(不支持自动链接的依赖项,或者其文档指定需要的依赖项)将其添加到Podfile中),但不包括React的。它应该看起来像这样:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
target 'YourRnApp' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
target 'YourRnAppTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
use_flipper!
post_install do |installer|
flipper_post_install(installer)
end
end
target 'YourRnApp-tvOS' do
# Pods for RnDiffApp-tvOS
target 'RnDiffApp-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
更多信息在这里:
https://react-native-community.github.io/upgrade-helper/?from=0.61.5&to=0.63.3
清理Podfile
后,清理缓存,运行pod install
并重建。
这时大多数错误都应该消失了。
在Xcode中检入不需要的任何其余手动库链接,然后将其删除(支持自动链接的链接),然后重新构建。
如果仍然无法正常工作,请检查RN升级帮助程序中的project.pbxproj
。
一个接一个地纠正错误。他们中的大多数应该可以使用RN升级助手和其他Stackoverflow答案进行修复。
答案 1 :(得分:0)
我认为 Flipper 库有问题,因此我们需要手动使用现在的“版本 2.3.0”。
如果您想使用鳍状肢,现在可以使用此解决方案:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
target 'pokeDex' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
target 'pokeDexTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
# Important to use at this momemt version 2.30
use_flipper!({ 'Flipper-Folly' => '2.3.0' })
post_install do |installer|
flipper_post_install(installer)
end
end
target 'pokeDex-tvOS' do
# Pods for pokeDex-tvOS
target 'pokeDex-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
如果没有,您可以像这样评论漏洞 use_flipper 安装脚本:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
target 'pokeDex' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
target 'pokeDexTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
# lines commented
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
# use_flipper!
# post_install do |installer|
# flipper_post_install(installer)
# end
end
target 'pokeDex-tvOS' do
# Pods for pokeDex-tvOS
target 'pokeDex-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end