react-native - 升级 react-native (0.60) 后,我遇到了 React/{Any filename}.h' file not found error with different packages
问题描述
无法构建应用程序我收到导入文件的错误未找到不同包的错误
所以我尝试使用 import 来导入“{Any filename}.h”
但是我反复遇到 react-native-linear-gradient、fast-image、webview 等错误
- 在这里,我尝试删除node_modules然后npm install并再次重建应用程序。它失败了
- 清理项目并删除派生数据。这也行不通
- 还删除了Pods和Podfile.lock然后清理并运行 pod install。没有任何效果。
❌ node_modules/react-native-fast-image/ios/FastImage/FFFastImageViewManager.h:1:9: 'React/RCTViewManager.h' 文件未找到
❌ node_modules/react-native-fast-image/ios/FastImage/RCTConvert+FFFastImage.h:1:9: 'React/RCTConvert.h' 文件未找到
进口
^~~~~~~~~~~~~~~~~~~~
进口
React/RCTViewManager.h' 文件未找到(这是由于线性渐变)包)
解决方案
我个人在此处添加了一些代码来Podefile
解决标题搜索路径问题
post_install do |installer|
puts 'post_install'
app_project = Xcodeproj::Project.open("./X.xcodeproj")
output = `find .. -name "*.xcodeproj"`
p output
output.split("\n").each do |projectPath|
app_project = Xcodeproj::Project.open(projectPath)
app_project.native_targets.each do |target|
target.build_configurations.each do |config|
if !config.build_settings['HEADER_SEARCH_PATHS']
config.build_settings['HEADER_SEARCH_PATHS'] ||= []
end
config.build_settings['HEADER_SEARCH_PATHS'] << ' $(SRCROOT)/Pods/Headers/**'
config.build_settings['HEADER_SEARCH_PATHS'] <<' $(SRCROOT)/../../../../ios/Pods/Headers/**'
config.build_settings['HEADER_SEARCH_PATHS'] << ' $(SRCROOT)/../../../ios/Pods/Headers/**'
config.build_settings['HEADER_SEARCH_PATHS'] << ' $(SRCROOT)/../../ios/Pods/Headers/**'
config.build_settings['HEADER_SEARCH_PATHS'] << ' $(SRCROOT)/../ios/Pods/Headers/**'
app_project.save
end
end
end
puts 'post_install DONE'
end
我希望我能帮上忙
推荐阅读
- flutter - 颤振仅在json不存在时才将数据添加到json
- c# - 内存性能 IList
与列表 财产 - php - 如何配置 Apache 以提供对来自被禁止 IP 地址的 POST 查询的自定义响应?
- java - 如何将 org.threeten.bp 库中的 OffsetDateTime 插入 db Oracle 列
- html - 在浏览器中显示 rgb8 像素数据
- c++ - 如何构建一个异常类来报告 C++ 中的哪些文件和行号?
- sql-server - 用函数插入另一个带有百分位数的表
- r - 如何调整 ggplot 轴标签的小数位?
- javascript - 在最终确定其内容之前开始文件下载
- php - Laravel 会话问题