[英]“config.h” file not found in iOS project of React native
In X-Code project of react native, getting error在 React Native 的 X-Code 项目中,出现错误
config.h file not found.找不到 config.h 文件。
Here is version detail :这是版本详细信息:
react-native-cli: 2.0.1
react-native: 0.51.0
How to solve it?如何解决?
Close Xcode.关闭 Xcode。
Open Terminal, go to your project's root folder and run:打开终端,转到项目的根文件夹并运行:
cd node_modules/react-native/third-party/glog-0.3.4/
Run the configure script:运行配置脚本:
./configure
Open Xcode and try to run your app.打开 Xcode 并尝试运行您的应用程序。
I had the same issue, using this steps solves for me:我遇到了同样的问题,使用以下步骤为我解决了:
Running into the same issue here after upgrading from 0.44.从 0.44 升级后在这里遇到同样的问题。 None of the above solutions or clearing caches did the trick for me.上述解决方案或清除缓存都没有对我有用。 Here's what I did to get things working again:这是我为让事情重新开始所做的工作:
react-native/third-party/glog
folder inside node_modules (for me, this was cd node_modules/react-native/third-party/glog-0.3.4
)在终端中,导航到react-native/third-party/glog
的react-native/third-party/glog
文件夹(对我来说,这是cd node_modules/react-native/third-party/glog-0.3.4
)sh ../../scripts/ios-configure-glog.sh
Glog is configured and the required config.h header file is created for Xcode to find一旦主动进入这个文件夹,运行sh ../../scripts/ios-configure-glog.sh
配置glog并创建所需的config.h头文件供Xcode查找Regards!问候!
When project files get messed up for me.当项目文件对我来说搞砸了。 I typically follow these steps.我通常遵循这些步骤。
rm -rf node_modules
npm install
react-native upgrade (Only changing affected files, so IOS for you)
react-native link
npm start --reset-cache
(In another terminal)
react-native run-ios
These steps worked for me:这些步骤对我有用:
rm -rf ~/.rncache
rm -rf node_modules/
npm install
npm start
You need to change to the legacy build system in Xcode 10 and install third party scripts manually.您需要在 Xcode 10 中更改为旧版构建系统并手动安装第三方脚本。
1: 1:
File -> Project/Workspace settings Build System: dropdown -> change to Legacy Build system文件 -> 项目/工作区设置构建系统:下拉列表 -> 更改为旧版构建系统
2: Follow this to manually install third party scripts for RN: 2:按照此为RN手动安装第三方脚本:
Clean RN cache清理 RN 缓存
$ rm -rf ~/.rncache $ rm -rf ~/.rncache
Re-install the deps重新安装deps
$ cd your_project_path $ rm -rf node_modules/ && npm install $ cd your_project_path $ rm -rf node_modules/ && npm install
Then install the third-party然后安装第三方
$ cd node_modules/react-native/scripts $ ./ios-install-third-party.sh $ cd node_modules/react-native/scripts $ ./ios-install-third-party.sh
Run the commands below if glog installation failed.如果 glog 安装失败,请运行以下命令。
$ cd ../third-party/glog-0.3.x $ ./configure $ cd ../第三方/glog-0.3.x $ ./configure
It works for me, I hope it helps for you.它对我有用,希望对你有帮助。
If above all answers don't work, Please check that there is no space
in any directory name of the full path and not only the project directory name.如果以上所有答案都不起作用,请检查完整路径的任何目录名称中是否有space
,而不仅仅是项目目录名称。
While in terminal, it accepts throgh My Disk
as My\\ Disk
but xcode do not recognize that.在终端中,它接受通过My Disk
作为My\\ Disk
但 xcode 无法识别。
If its in My Disk directory, try after moving it to Desktop or any other directory which doesn't have space in their name.如果它在我的磁盘目录中,请尝试将其移动到桌面或名称中没有空格的任何其他目录。
configure: error: unsafe absolute working directory name Issue:配置:错误:不安全的绝对工作目录名称问题:
-Open Terminal, go to your project's root folder and run: - 打开终端,转到项目的根文件夹并运行:
./configure ./配置
got error: configure: error: unsafe absolute working directory name得到错误:配置:错误:不安全的绝对工作目录名称
try to created app in desktop and from there run ./configure command.尝试在桌面上创建应用程序,然后从那里运行 ./configure 命令。
Please note with XCOXE 10, and Mojave MAC OS , I had same issue, ./configure was showing some permission issue, I had set permission "777" to project folder enclosing with inner folders请注意 XCOXE 10 和 Mojave MAC OS,我遇到了同样的问题,./configure 显示了一些权限问题,我已将权限“777”设置为包含内部文件夹的项目文件夹
This is the linking issue in xcode.这是 xcode 中的链接问题。 You just need to re-link the files.您只需要重新链接文件。 Please follow the below steps:请按照以下步骤操作:
If after running the project you are getting linking issue then please make sure you have added all the (ios) products () come under the Libraries -> React.xcodeproj -> Products in your Build Phases -> Link Binary With Libraries .如果在运行项目后遇到链接问题,请确保已将所有 (ios) products () 添加到Libraries -> React.xcodeproj -> Products in your Build Phases -> Link Binary With Libraries 。
If everyone has tried solving the issue by this Open Terminal, go to your project's root folder and run: cd node_modules/react-native/third-party/glog-0.3.4/ Run the configure script: ./configure如果每个人都尝试通过此Open Terminal解决问题,请转到项目的根文件夹并运行:cd node_modules/react-native/third-party/glog-0.3.4/ 运行配置脚本:./configure
But still not got the solution then,但还是没有得到解决方案,
Go to your Xcode and check if there any library is missing.转到您的 Xcode 并检查是否缺少任何库。 Add that library and then perform this above step.添加该库,然后执行上述步骤。
What finally worked for me was the following:最终对我有用的是以下内容:
cd node_modules/react-native
./scripts/ios-install-third-party.sh
cd third-party/glog-[version]
./configure
The credit goes to this post: https://github.com/facebook/react-native/issues/20774#issuecomment-424745903 .归功于这篇文章: https : //github.com/facebook/react-native/issues/20774#issuecomment-424745903 。 According to it, the third-party
directory's location is incorrect.据此, third-party
目录的位置不正确。 It should be node_modules/react-native/third-party
, but if you run the scripts as some answers here suggest, those dependencies get installed in react-native/scripts/third-party
.它应该是node_modules/react-native/third-party
,但是如果您按照此处的某些答案建议运行脚本,则这些依赖项将安装在react-native/scripts/third-party
。
Although the already mentioned answers are correct but still few guys are struggling, as only configuring the glog doesn't sometimes resolve the error.尽管已经提到的答案是正确的,但仍然很少有人在挣扎,因为仅配置 glog 有时并不能解决错误。 Here I have written a detailed solution to the problem.这里我写了一个详细的解决问题的方法。
Solution: config.h file not found mutex.h During Archive . 解决方案:在存档期间找不到 config.h 文件 mutex.h 。
The steps are the following:步骤如下:
For all these above steps the I have shared commands in the above mentioned article, so not going to write again.对于以上所有步骤,我已经在上面提到的文章中分享了命令,所以不打算再写了。 I hope it will solve problem for guys who are still struggling.我希望它可以为仍在挣扎的人解决问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.