更新到本机0.59并尝试为iOS构建应用程序后,出现以下错误:
找不到构建输入文件:'/app/node_modules/react-native/ReactCommon/yoga/yoga/YGFloatOptional.cpp'
对我来说奇怪的是,在当前的主目录中我也找不到此文件: react-native/tree/master/ReactCommon/yoga/yoga
(仅YGFloatOptional.h
)
我们从0.57.7→0.59升级了一个中型项目。
构建应该像以前一样运行良好。
React Native Environment Info:
System:
OS: macOS 10.14.3
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Memory: 2.95 GB / 32.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.15.1 - /var/folders/1r/ymkpxdlj21lb638kzp4jxvwm0000gn/T/yarn--1552463658468-0.20119758467048565/node
Yarn: 1.13.0 - /var/folders/1r/ymkpxdlj21lb638kzp4jxvwm0000gn/T/yarn--1552463658468-0.20119758467048565/yarn
npm: 6.4.1 - /usr/local/Cellar/node@10/10.15.1/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 23, 24, 25, 27, 28
Build Tools: 23.0.1, 23.0.3, 24.0.1, 25.0.0, 27.0.3, 28.0.3
System Images: android-24 | ARM 64 v8a, android-24 | ARM EABI v7a, android-24 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom_64
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5264788
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.0 => 0.59.0
我刚刚用XCode复制了此问题:10.1和RN 0.59.0。
编辑1 :我可以使用XCode UI构建工具进行复制; 但是使用react-native run-ios
可以正常工作(请确保拥有最新的2.x cli)。
编辑2 :通过启用旧版构建,我设法使其与XCode 10.1一起使用。 相关#19573
嗯,我刚刚从0.58.4
升级到0.59
,在XCode中清除了构建目录,并且我能够运行调试和存档应用程序。 我正在使用XCode 10.1。
我的升级策略:
想知道是否一切都对我有用,因为我曾经工作过0.58.4
并在上面加上了新的东西?
编辑:我也已经运行npm ci
为了删除我的node_modules
(只是为了确保),我仍然能够从XCode生成应用程序
EDIT2:而且我没有YGFloatOptional.cpp
:
我从0.57.8-> 0.59.1升级时遇到了同样的问题。
看一个新的0.59.1初始化,没有YGFloatOptional.cpp
文件。
将这些行添加到您的Podfile中:
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'
并运行
pod install
@jpudysz是的,在迁移到cocoapod并使用.xcworkspace
文件打开XCode项目后工作。
我必须使用react-native unlink
和react-native link
桥接库,以便它们改用Podfile
。
旧版(无cocoapod)链接是否应弃用?
@jpudysz也为我工作。 当然可以,但这不是正确的解决方案吗? 这严重使项目肿。 Pods/boost-for-react-native
是160.8MB。
编辑:确实很奇怪,我删除了这三个吊舱,在Xcode中运行Clean并尝试构建。 这次我在编译Yoga时没有出错。
谢谢@jpudysz 。 按照您的解决方案,然后出现以下错误:
在JSBundleType.h中找不到'folly / Portability.h'文件
有人知道发生了什么吗?
非常感谢。
在尝试了几乎所有东西之后,RN标准升级,git升级工具,应用了diff补丁,我最终重新创建了一个全新的项目,并进行了极其繁琐的代码库重建工作。 他们说从0.59开始会更好。.希望他们是对的
我刚刚从0.59.0升级到0.59.1,对我有用
解决了瑜伽问题
我也升级了,但是到目前为止没有运气。
我有完全相同的问题。 好的旧rm -rf node_modules && npm i
并清理了构建文件夹为我做了
使用npm audit fix
,我的'react-native'会自动升级到版本0.59,并且无法构建我的项目。
解决方案:将版本降级至较低版本。
npm install react-native@<version>
示例: npm install [email protected]
我尝试手动从0.58.4更新(跟随rn-diff-purge更改),但我也遇到了RN 0.59.0或0.59.1的问题
是的,我们有YGFloatOptional.cpp
直到0.58 https://github.com/facebook/react-native/blob/0.58-stable/ReactCommon/yoga/yoga/YGFloatOptional.cpp
这里到底发生了什么?
编辑
@jpudysz的解决方案将我引向另一个找不到文件的错误'folly/Portability.h' file not found
从0.58.4升级到0.59.0和0.59.1后,“ folly / Portability.h”也出现了相同的问题
奇怪的是,XCode在编译后指出未找到Portability.h,但在编辑器中,它获取了在标头中定义的所有类型...
无法编译的文件是React库中的RCTJavasScriptLoader.mm。
CompileC /Users/xxx/Projects/xxx/ios/build/xxx/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React.build/Objects-normal/x86_64/RCTJavaScriptLoader.o /Users/xxx/Projects/xxx/node_modules/react-native/React/Base/RCTJavaScriptLoader.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target: React)
cd /Users/xxx/Projects/xxx/ios/Pods
export LANG=en_US.US-ASCII
/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=c++14 -stdlib=libc++ -fobjc-arc -fobjc-weak -fmodules -fmodules-cache-path=/Users/xxx/Projects/xxx/ios/build/xxx/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/xxx/Projects/xxx/ios/build/xxx/ModuleCache.noindex/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 -Wdocumentation -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -Wno-c++11-extensions -DPOD_CONFIGURATION_DEBUG=1 -DDEBUG=1 -DCOCOAPODS=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -Winvalid-offsetof -mios-simulator-version-min=9.0 -g -Wno-sign-conversion -Winfinite-recursion -Wmove -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wrange-loop-analysis -Wno-semicolon-before-method-body -Wunguarded-availability -fobjc-abi-version=2 -fobjc-legacy-dispatch -index-store-path /Users/xxx/Projects/xxx/ios/build/xxx/Index/DataStore -iquote /Users/xxx/Projects/xxx/ios/build/xxx/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React.build/React-generated-files.hmap -I/Users/xxx/Projects/xxx/ios/build/xxx/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React.build/React-own-target-headers.hmap -I/Users/xxx/Projects/xxx/ios/build/xxx/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React.build/React-all-non-framework-target-headers.hmap -ivfsoverlay /Users/xxx/Projects/xxx/ios/build/xxx/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React.build/all-product-headers.yaml -iquote /Users/xxx/Projects/xxx/ios/build/xxx/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React.build/React-project-headers.hmap -I/Users/xxx/Projects/xxx/ios/build/xxx/Build/Products/Debug-iphonesimulator/React/include -I/Users/xxx/Projects/xxx/ios/Pods/Headers/Private -I/Users/xxx/Projects/xxx/ios/Pods/Headers/Private/React -I/Users/xxx/Projects/xxx/ios/Pods/Headers/Public -I/Users/xxx/Projects/xxx/ios/Pods/Headers/Public/React -I/Users/xxx/Projects/xxx/ios/Pods/Headers/Public/yoga -I/Users/xxx/Projects/xxx/node_modules/react-native/ReactCommon -I/Users/xxx/Projects/xxx/ios/build/xxx/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React.build/DerivedSources/x86_64 -I/Users/xxx/Projects/xxx/ios/build/xxx/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React.build/DerivedSources -F/Users/xxx/Projects/xxx/ios/build/xxx/Build/Products/Debug-iphonesimulator/React -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -include /Users/xxx/Projects/xxx/ios/Pods/Target\ Support\ Files/React/React-prefix.pch -MMD -MT dependencies -MF /Users/xxx/Projects/xxx/ios/build/xxx/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React.build/Objects-normal/x86_64/RCTJavaScriptLoader.d --serialize-diagnostics /Users/xxx/Projects/xxx/ios/build/xxx/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React.build/Objects-normal/x86_64/RCTJavaScriptLoader.dia -c /Users/xxx/Projects/xxx/node_modules/react-native/React/Base/RCTJavaScriptLoader.mm -o /Users/xxx/Projects/xxx/ios/build/xxx/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React.build/Objects-normal/x86_64/RCTJavaScriptLoader.o
In file included from /Users/xxx/Projects/xxx/node_modules/react-native/React/Base/RCTJavaScriptLoader.mm:12:
/Users/xxx/Projects/xxx/node_modules/react-native/ReactCommon/cxxreact/JSBundleType.h:
info fatal error:
'folly/Portability.h' file not found
#include <folly/Portability.h>
^~~~~~~~~~~~~~~~~~~~~
1 error generated.
我遇到了同样的问题...,每次在响应本机升级时遇到一些问题,都感到很累。
自2018年12月13日以来,该文件似乎已从Yoga项目中删除并``内联''到yoga/YGFloatOptional.h
: https :
我的猜测是不再需要引用ReactCommon/yoga/yoga/YGFloatOptional.cpp
。
删除缓存并重建项目对我来说并没有立即生效。
所以我尝试升级到React Native 0.59.1,然后重建项目。 也没有用。
但是,然后使用以下方法清理我的node_modules,缓存和构建文件夹并重建项目,确实可以正常工作。
rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/metro-* && rm -rf $TMPDIR/haste-* && watchman watch-del-all && npm cache clean --force && npm cache verify && rm -rf ios/build && rm -rf node_modules/ && npm i
因此,似乎与缓存有关。
也许不需要升级到React Native 0.59.1,我认为脚本的一部分对我有用。
希望这对别人有帮助!
我放弃了,我从Pods文件中删除了到node_modules的所有链接,然后删除了node_modules并构建目录,然后重新安装了所有内容,然后终于再次成功构建了。
太累了。
@jvandenaardweg我认为您是对的,这是一个缓存问题。
对我来说,有效的方法是删除Xcode的派生数据文件夹并重新启动Xcode。
rm -rf ~/Library/Developer/Xcode/DerivedData
重新启动后,我尝试进行构建,但构建失败,并提示我关闭并重新打开xcode工作区。 一旦这样做,我就尝试再次构建,并且成功了。
好的,我想这个问题通常是关于升级(从阅读帖子)到构建缓存的问题-因此,如果您有问题,我认为通常可以通过以下方法解决:
rm -rf node_modules; rm -rf Pods
然后重新安装react-native upgrade x.y.z
我敢打赌,每个版本都差不多。 我可能会考虑在react-native-cli上提出一个问题,以改善此问题,并可能运行一些命令本身。
有人为此有特定的复制步骤吗?
我也看到#include <folly/Portability.h>
错误。 就我而言,问题是Podfile中缺少子规范。
它对我来说很好:
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge', # Include this for RN >= 0.47
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTText',
'RCTNetwork',
'RCTWebSocket', # needed for debugging
'RCTImage',
'RCTWebSocket', # Needed for debugging
'RCTAnimation', # Needed for FlatList and animations running on native UI thread
# Add any other subspecs you want to use in your project
]
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
# Third party deps podspec link
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'
“在本机0.57.8和0.58.5之间,Xcode项目中添加了一个大变化,即您必须将JavaScriptCore.Framework添加到Linked FrameWorks和库中”-从这里开始
加
@jvandenaardweg回答:
rm -rf $TMPDIR/metro-* && rm -rf $TMPDIR/haste-* && watchman watch-del-all && npm cache clean --force && npm cache verify && rm -rf ios/build && rm -rf node_modules/ && npm i
为我做了工作。
正如其他人所说,这确实令人沮丧,需要猜测其破坏了之前有效的代码的原因。
同样在Android上,我必须升级Build Gradle版本才能再次工作。
需要猜测
就是说,我们已经在变更日志和发布选项卡中编写了重大更改,因此不需要真正的猜测。
无论如何,因为这显然与升级有关,所以关闭-同样,通常,您可以在升级时使用rn-diff-repo检查所有必要的步骤。
你好,
经过大量的挖掘,我设法弄清了为什么会遇到这个问题。 清理缓存,一切都无法解决我的问题,而我仍然拥有#include
对于我的项目下的React项目,它的编译效果很好,但是无法针对我拥有的Pod进行编译。
即使添加了Folly / glog / DoubleConversion Pod,我仍然遇到问题。
然后,我修改了React.podspecs文件以编辑Core子规范
将Folly引用添加到pod_target_xcconfig后,它可以进行编译而没有任何其他问题。
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/Folly\"" }
这是我拥有的完整podfile
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
target 'CryptoReact' do
platform :ios, '9.0'
pod 'CodePush', :path => '../node_modules/react-native-code-push'
pod 'Firebase/Core', '~> 5.14.0'
pod 'react-native-sqlite-storage', :path => '../node_modules/react-native-sqlite-storage'
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga/yoga.podspec'
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'
pod 'react-native-randombytes', :path => '../node_modules/react-native-randombytes'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen'
pod 'RNLocalize', :path => '../node_modules/react-native-localize/ios'
pod 'react-native-camera', :path => '../node_modules/react-native-camera'
pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
pod 'react-native-keep-awake', :path => '../node_modules/react-native-keep-awake'
pod 'SwiftyJSON', '4.2.0'
pod 'Charts', '3.1.1'
pod 'Fabric', '~> 1.9.0'
pod 'Crashlytics', '~> 3.12.0'
pod 'Firebase/Performance', '~> 5.14.0'
pod 'Firebase/Auth', '~> 5.14.0'
pod 'lottie-ios', :path => '../node_modules/lottie-ios'
pod 'lottie-react-native', :path => '../node_modules/lottie-react-native'
pod 'react-native-webview', :path => '../node_modules/react-native-webview'
pod 'RNScreens', :path => '../node_modules/react-native-screens'
pod 'ReactNativeExceptionHandler', :podspec => '../node_modules/react-native-exception-handler/ReactNativeExceptionHandler.podspec'
pod 'RCTRestart', :path => '../node_modules/react-native-restart/ios'
pod 'react-native-version-number', :path => '../node_modules/react-native-version-number'
pod 'RNBackgroundFetch', :path => '../node_modules/react-native-background-fetch'
pod 'React', :path => '../node_modules/react-native', :subspec => [
'Core',
'ART',
'cxxreact',
'CxxBridge', # Include this for RN >= 0.47
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTText',
'RCTNetwork',
'RCTWebSocket', # needed for debugging
'RCTImage',
'RCTWebSocket', # Needed for debugging
'RCTAnimation', # Needed for FlatList and animations running on native UI thread
'RCTPushNotification',
# Add any other subspecs you want to use in your project
]
end
swift4 = ['Charts']
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if swift4.include?(target.name)
config.build_settings['SWIFT_VERSION'] = '4.1'
end
end
end
end
我处于同样的情况。 在响应本机差异后,我已从0.57升级到0.59,一切正常,直到我将0.58.6升级到0.59。
我在这个线程上尝试了所有事情,但是没有运气,“ folly / Portability.h”文件未找到错误只是不想消失。
回滚到0.58.6效果很好,但是当我更新到0.59.0或0.59.1时,就会出现错误。
编辑:我在node_modules / react-native / third-party / folly-2018.10.22.00 / folly / Portability.h中找到了文件,但它仍然说不存在。
我意识到我的帖子还不清楚...很抱歉。 这是一个diff文件,对于那些对'folly / Portability.h'有疑问的人,它应该更明确
尝试对nodes_modules / react-native / React.podspec文件进行以下修改,至少在我看来它已经起作用了! 现在,我可以编译我的项目并启动它而不会出现问题。
diff --git a/node_modules/react-native/React.podspec b/node_modules/react-native/React.podspec
s.subspec "Core" do |ss|
[...]
ss.header_dir = "React"
ss.framework = "JavaScriptCore"
ss.libraries = "stdc++"
- ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" }
+ ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/Folly\"" }
end
做@aaska说的话再加上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'
到Podfile,然后安装它们的pod对我有用。
使用@jpudysz , @jvandenaardweg和@johnryan技巧后,它也为我构建。
多谢你们!
@ th3ac3为我解决了这个问题。 谢谢!
他们都没有工作
@jvandenaardweg我认为您是对的,这是一个缓存问题。
对我来说,有效的方法是删除Xcode的派生数据文件夹并重新启动Xcode。
rm -rf ~/Library/Developer/Xcode/DerivedData
重新启动后,我尝试进行构建,但构建失败,并提示我关闭并重新打开xcode工作区。 一旦这样做,我就尝试再次构建,并且成功了。
谢谢,我做到了,它再次起作用。
因此,在将diff升级到59.4之后(使用rn-diff-purge ),我仍然和这里的每个人都有相同的问题(首先出现YGFloatOptional.cpp
错误,然后是folly/Portability.h
错误)。 但是,这些解决方案本身都不起作用,因此这是我为解决问题而采取的措施:
# Clean caches/build folder/existing pods
rm -rf node_modules
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf ios/build
rm -rf ios/Pods
# Reinstall deps
npm install
然后将我的Podfile更新为以下内容:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'CityChallenge' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
pod 'React', :path => '../node_modules/react-native', subspecs: [
# Comment out any unneeded subspecs to reduce bundle size.
'Core',
'CxxBridge', # --> I was missing Cxxbridge here, may have resolved the issue for me as well
'DevSupport',
'RCTActionSheet',
'RCTAnimation',
'RCTBlob',
'RCTCameraRoll',
'RCTGeolocation',
'RCTImage',
'RCTNetwork',
'RCTPushNotification',
'RCTSettings',
'RCTTest',
'RCTText',
'RCTVibration',
'RCTWebSocket',
'RCTLinkingIOS'
]
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
# Third party --> This bit is also new
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
end
之后,我重新安装了豆荚
cd ios
pod install
只有这样,项目才能再次成功构建
就我而言,我只是忘记了执行以下步骤:
如果您是iOS开发人员,则升级时需要手动链接JavaScriptCore.framework; 这可以通过Xcode并按照此处显示的步骤进行。
在我这样做之后,xcode就可以编译了
以上都不对我有用
检查一下: https :
它为我解决了这个问题。
把它放在控制台-> xcrun -k --sdk iphoneos --show-sdk-path
如果答案是
xcrun:_错误:找不到SDK“ iphoneos”
xcrun:错误:找不到SDK“ iphoneos”
xcrun:错误:无法在SDK'iphoneos'中查找项目'Path'然后把这个sudo xcode-select --switch /Applications/Xcode.app
然后再次安装吊舱
这个答案对我有用。 在此线程中上面提到的所有事情之上,我需要重新打开我的地铁捆绑器正在运行的终端。
降级为"react-native": "0.57.4",
,然后重新运行
降级为
"react-native": "0.57.4",
,然后重新运行
我不认为降级到此版本是@miukki的最佳方法。 此版本(0.59)为Android应用程序带来了64位支持,您将来需要使用它来发布应用程序(信息请参见此处)。
接近上述所有解决方案后,我发现了另一个错误
ld:警告:找不到选项'-F / Users / pumeo / Library / Developer / Xcode / DerivedData / GreenPlanet-cekcooliietupofcqlsnkupeolal / Build / Products / Debug-iphonesimulator / React'的目录
ld:找不到框架React
clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)
当我插入post_install
有人可以帮忙吗?
我正在使用hackintosh
@ Pumeo1010 ,请继续关注。
主题:如果该问题已解决,解决方案是什么? 我已经尝试了上面的所有内容,并使其以某种方式起作用(不知道该操作是什么)。 现在,我不得不重新构建并再次遇到相同的问题,无论我怎样尝试都无法使其正常工作。
更新:终于让它再次工作! 我并不完全确定,但是我认为删除Xcode派生数据,删除Podfile.lock,删除/重新安装pods-dir,清理Xcode构建文件夹以及重新启动系统最终解决了问题。
我试图将React Native从0.57.8升级到0.59.9将近两天。 我已经尝试过此注释上方的所有解决方案,但仍然遇到相同的错误。 没有重复的符号,没有找到标题,没有找到YGFloatOptional.cpp...。我创建了一个新的React Native项目,然后将现有的项目文件复制到该新项目中,并在rn-diff-purge的帮助下应用了差异。 同样,通过这种方式,我也遇到了许多不同的构建错误,最后我放弃了! 我爱v0.57.8
因此,在将diff升级到59.4之后(使用rn-diff-purge ),我仍然和这里的每个人都有相同的问题(首先出现
YGFloatOptional.cpp
错误,然后是folly/Portability.h
错误)。 但是,这些解决方案本身都不起作用,因此这是我为解决问题而采取的措施:# Clean caches/build folder/existing pods rm -rf node_modules rm -rf ~/Library/Developer/Xcode/DerivedData rm -rf ios/build rm -rf ios/Pods # Reinstall deps npm install
然后将我的Podfile更新为以下内容:
# Uncomment the next line to define a global platform for your project # platform :ios, '9.0' target 'CityChallenge' do # Uncomment the next line if you're using Swift or would like to use dynamic frameworks # use_frameworks! pod 'React', :path => '../node_modules/react-native', subspecs: [ # Comment out any unneeded subspecs to reduce bundle size. 'Core', 'CxxBridge', # --> I was missing Cxxbridge here, may have resolved the issue for me as well 'DevSupport', 'RCTActionSheet', 'RCTAnimation', 'RCTBlob', 'RCTCameraRoll', 'RCTGeolocation', 'RCTImage', 'RCTNetwork', 'RCTPushNotification', 'RCTSettings', 'RCTTest', 'RCTText', 'RCTVibration', 'RCTWebSocket', 'RCTLinkingIOS' ] pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga' # Third party --> This bit is also new pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' end
之后,我重新安装了豆荚
cd ios pod install
只有这样,项目才能再次成功构建
@Hless嗨。 我尝试了您的解决方案。 这是我的Podfile
target '..' do
# this is very important to have!
rn_path = '../node_modules/react-native'
pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
pod 'React', path: rn_path, subspecs: [
'Core',
'CxxBridge',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket'
]
pod 'RNImageCropPicker', :path => '../node_modules/react-native-image-crop-picker'
pod 'AppCenter/Crashes', '~> 1.12.0'
pod 'AppCenter/Analytics', '~> 1.12.0'
pod 'AppCenterReactNativeShared', '~> 1.11.0'
pod 'Fabric'
pod 'Crashlytics'
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
platform :ios, '9.0'
pod 'react-native-webview', :path => '../node_modules/react-native-webview'
pod 'react-native-document-picker', :path => '../node_modules/react-native-document-picker'
pod 'react-native-video', :path => '../node_modules/react-native-video'
pod 'RNReanimated', :path => '../node_modules/react-native-reanimated'
pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'
pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
end
end
但是由于重复的符号错误,这次构建失败。 我找到了这个解决方案,现在可以成功构建了。 但是现在我有另一个问题。 一旦运行该应用程序,它将立即崩溃。 我在Xcode的调试区域中找到了错误原因,这是Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RCTRootView reactTag]: unrecognized selector sent to instance 0x7fbf02c05530'
解决此问题的方法与其他解决方案相反。 多么糟糕的升级故事。 :(
最终,我努力地完成了升级进度,然后成功构建了iOS项目并在模拟器上运行它,没有任何错误。 首先,我在rn-diff-purge的帮助下应用了diff,然后在遇到重复符号错误的最后应用了@Hless '解决方案,并按照此解决方案上的步骤进行了操作,我修复了它们,现在项目也可以正常工作。
解决以下问题:
rm -rf node_modules
rm -rf ios/Pods
rm ios/Podfile.lock
rm -rf ~Library/Developer/Xcode/DerivedData
然后我重新安装了我的依赖项(npm和pod),它起作用了:)
rm -rf〜库/开发人员/ XCode / DerivedData
右边的行将是: rm -rf ~/Library/Developer/Xcode/DerivedData
每次遇到RN令人毛骨悚然的问题,给我一些无意义的错误消息时,我都会进行绝望的github搜索以寻求解决方案。 大多数情况下,解决方案是删除缓存,删除派生数据,重新打开Xcode,清除构建文件夹等。多年来,我将这个bash脚本放在一起,并将其作为npm脚本添加到package.json中。 现在,我针对大多数问题的第一个goto解决方案是npm run clear
。
// package.json
{
"scripts": {
"clear": ". scripts/Clear.sh",
}
}
// scripts/Clear.sh
#!/bin/bash
echo "rm -rf ios/build..."
rm -rf ios/build
echo "rm -rf android/app/build..."
rm -rf android/app/build
echo "Removed all Xcode derived data..."
rm -rf ~/Library/Developer/Xcode/DerivedData
echo "rm -rf lib... (for Flow)"
rm -rf lib
echo "watchman watch-del-all..."
watchman watch-del-all
echo "rm -rf node_modules..."
rm -rf node_modules
echo "npm install..."
npm install
echo "rm -rf $TMPDIR/react-*..."
rm -rf $TMPDIR/react-*
echo "rm -rf $TMPDIR/haste-map-react-native-packager-*..."
rm -rf $TMPDIR/haste-map-react-native-packager-*
PS。 它也为我解决了这个问题:D
只是pod install
对我有用
请。 降级的Xcode 10.1
另一个react-native link
帮助了我。 :(
React Native是不可持续的,有人遇到的每个错误都提供100种解决方案。 一次更改和整个构建过程,样板和使用本机的原因就不存在了。 公司如何才能真正地将此开发过程添加到产品管道中。 荒谬!!!!
他们说从0.59开始会更好。.希望他们是对的
@philipaarseth我希望你能在0.60出来的时候吃完饭😆
我之前在其他线程中已经看到了这一点,但是运行以下命令为我解决了这个问题:
cd node_modules/react-native/scripts
./ios-install-third-party.sh
我以为该问题已在0.59或更早版本中得到修复,并且我记得看到它在某些版本中会自动运行,但是看起来仍然有些情况下缺少它。
绝对值得在您的项目的疑难解答部分包括该内容,因为这不是我第一次看到这种情况。
运行以下命令:$ conda deactivate
@jpudysz谢谢,它对我
我的错误日志是:
以下命令产生了分析器问题:
分析/Users/superqa/jenkins/workspace/xxxxx-xxxx-iOS-new/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp正常arm64
分析Base / RCTModuleMethod.mm正常arm64
(2个存在分析器问题的命令)
Android确实运行完美,只是iOS ... :-(
唯一有前途的工作可能是不幸地降级了RN版本
当有很多第三方依赖时,这变得相当困难。
就我而言,Xcode只是进行了自动更新并产生了此类问题。
我为解决该问题所做的是:
光盘ios
rm -fr豆荚
rm Podfile.lock
吊舱安装
重新安装Pods和Podfile解决了我的问题
删除派生数据
光盘ios
删除Pods和Podfile.lock
吊舱安装
我已经完成了上述所有步骤,并使构建正常进行,现在出现此错误。 FWIW我正在从Xcode 10.1-> 11.1升级并且我正在从0.57.8-> 0.59.9升级react native
dyld: Library not loaded: @rpath/XCTest.framework/XCTest
Referenced from: /Users/par/Library/Developer/CoreSimulator/Devices/2B68242E-D2AF-49A4-9AEA-C320820D8D2F/data/Containers/Bundle/Application/E665681B-C213-42C0-9A51-746B4CA17599/Kismet.app/Kismet
Reason: image not found
编辑:我从Podfile中删除了RCTTest,那之后很好。
我也看到
#include <folly/Portability.h>
错误。 就我而言,问题是Podfile中缺少子规范。它对我来说很好:
pod 'React', :path => '../node_modules/react-native', :subspecs => [ 'Core', 'CxxBridge', # Include this for RN >= 0.47 'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43 'RCTText', 'RCTNetwork', 'RCTWebSocket', # needed for debugging 'RCTImage', 'RCTWebSocket', # Needed for debugging 'RCTAnimation', # Needed for FlatList and animations running on native UI thread # Add any other subspecs you want to use in your project ] pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga' # Third party deps podspec link 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'
我遇到了要安装glog的问题,最终不得不发出此命令sudo xcode-select --switch /Applications/Xcode.app/
因为我是从其他目录运行Xcode,然后将其移至我的/ Applications目录,因此工具全部搞砸了。
@jenskuhrjorgensen您的rm
命令正在删除整个$ TMPDIR,因为那里有空间。
@ jduffy7可能有点矫kill过正😄Thx,它已经得到纠正!
@jenskuhrjorgensen谢谢!!!!!
运行pod update
对我有用。
任何更新 .. ?
上面的解决方案不起作用,以下解决方案帮助我的项目再次构建。
cd ios
pod repo update
pod update
运行这些命令后,我能够在xcode上构建,但不能使用react-native run-ios
。 然后我运行了以下命令(感谢https://github.com/facebook/react-native/issues/23886#issuecomment-509528212):
rm -rf ios/build
rm -rf ~/Library/Developer/Xcode/DerivedData
watchman watch-del-all
rm -rf node_modules
npm install
这帮助我再次使用react-native run-ios
构建。
尝试: https :
@khanguslee我做到了,但不幸的是它不会建立
并得到这个错误
*建立失败*
以下构建命令失败:
PhaseScriptExecution [CP]检查Pod Manifest.lock /../ios/build/music/Build/Intermediates.noindex/music.build/Debug-iphonesimulator/music.build/Script-C5D676D55145145333E00AC9.sh
(1次失败)
显示所有消息
:-1:沙箱与Podfile.lock不同步。 运行“ pod install”或更新您的CocoaPods安装。
沙箱与Podfile.lock不同步。 运行“ pod install”或更新您的CocoaPods安装。
使用您的错误消息对Google进行快速搜索可以在此处为我提供解决方案
最有用的评论
我遇到了同样的问题...,每次在响应本机升级时遇到一些问题,都感到很累。