"config.h" file not found react native iOS - react-native

I tried almost all the solutions given to resolve this issue but nothing is working for me.
This issue is occurring when I am opening .xcodeproj
Can anyone please provide a permanent solution for this?

1) Close your Xcode.
2) Open Terminal, go to your project's root folder and do:
cd node_modules/react-native/third-party/glog-0.3.4/
3) Run the configure script:
./configure
4) Open Xcode and try to run your app.

You need to change to the legacy build system in Xcode 10 and install third party scripts manually.
File > Project/Workspace settings
Build System: dropdown > change to Legacy Build system
Follow this to manually install third party scripts for RN:
Clean RN cache
$ rm -rf ~/.rncache
Re-install the deps
$ 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
Run the commands below if glog installation failed.
$ cd ../third-party/glog-0.3.x
$ ./configure

This issue is caused by Xcode's recent update. I fixed this issue by the following easy steps and I found this to be the best solution after searching for a while and tried many.
Go to Xcode > File > Project Settings
Build System > Select "Legacy Build System"
Go to terminal and run cd /to-your-project-folder
Run rm -rf node_modules && yarn (to remove node_modules and reinstall them)
Go back to Xcode > Product > Clean
Product > press option key and then click Clean Build Folder
And click the clean button
Now you can run the project from Xcode or on the terminal run yarn run ios or react-native run-ios
Credits to Spencer Carli's video on YouTube
I hope this helps :-)

Related

React-native -run-ios error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65

good time.
run ios error Failed
run code
react-native run-ios
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening reactapp.xcodeproj
** BUILD FAILED **
I've got the same error when run
$ react-native run-ios
My workaround steps:
open project by Xcode and choose the signature information as the attached image.
clear build folder: 'Your Project'/ios/build
re-run:
$ react-native run-ios
Hope this help.
That's because there is a new version of Flipper and React Native might not come with the right one so best is to go in your podfile and add this use_flipper!({ 'Flipper' => '0.74.0' }) then run pod install
If you don't have cocoa pods installed you need to by command sudo gem install cocoapods and run following commands from your project main directory
cd ios
pod install
cd ..
delete build folder from ios
react-native run-ios
if error persists, 1. delete build folder again 2. open the /ios folder in x-code 3. navigate File -> Project Settings -> Build System -> change (Shared workspace settings and Per-User workspace settings): Build System -> Legacy Build System
cd ios
rm -rf build/
cd ..
react-native run-ios

React Native update third party automatically after npm install

I am a newbie on react native.
Is it possible to setup the correct sdk version or other things for the third party library automatically after npm install? Because sometimes when i mess up the project and the code cannot be rolled back, i will remove it and clone the project from git. But that is the problem, because the android library sdk version and ios library search path are incorrect, i need to correct them by myself.
Add postinstall into the package.json scripts. This will be run automatically after install has ran:
"postinstall": "./edit_modules.sh",
And create an edit_modules.sh file in project root directory. Something like this:
#!/bin/bash
if [[ "$OSTYPE" == "darwin"* ]]; then
SED_CMD="sed -i ''"
else
SED_CMD="sed -i"
fi
$SED_CMD 's/<pattern to find>/<replace with>/' <path to file relative to root>
The if/else for sed is because it has different signature on macos and linux.
And example sed we have in our project:
$SED_CMD 's/#import <fishhook\/fishhook.h>/#import "fishhook.h"/' ./node_modules/react-native/Libraries/WebSocket/RCTReconnectingWebSocket.m

config.h file not found

I am working on thr react-native platform. I am using iOS. After creating project, the following error found:
config.h file not found mutex.h
Please help me resolve this issue.
The solution works for me is:
Quit your Xcode
Navigate to
cd node_modules/react-native/third-party/glog-0.3.4/
Then execute command:
./configure && make && make install
Now open project in Xocde, Build and Run.
Run the following commands in the project directory. Helped me resolve my config.h not found issue
cd node_modules/react-native/third-party/glog-0.3.4/
./configure
make
make install
cd ../../../..
react-native run-ios

Mojave + Xcode 10 build fails on glog config.h, gflags/gflags.h

I'm testing React Native 0.56.0-rc.2 on Mac OS Mojave and Xcode 10.
Running:
react-native init TestProject --version="0.56.0-rc.2"
cd TestProject
npm run start
react-native run-ios
Which generated some long errors.
Entering Xcode gave me a failure on missing config.h for glog, which I found could be built manually:
cd ./node_modules/react-native/third-party/glog-0.3.4
./configure && make && make install
Which passed that stage, but got me on yet another issue
(...)/node_modules/react-native/third-party/glog-0.3.4/src/glog/logging.h:85:10:
'gflags/gflags.h' file not found
I can't find anything related to RN and this on Google or Stack Overflow, only references to other packages and instructions to install those on a Debian-based system.
Is this a known issue?
Running this from the project directory fixed it for me:
cd ./node_modules/react-native/third-party/glog-0.3.4 && ../../scripts/ios-configure-glog.sh
This manually triggers the config script
A simple and quick resolution.
In Xcode, go to File->Project/Workspace settings.
Change the build system to Legacy Build system.
This is the resolution from Wesley's link. Saw something the other day about posting the direct answer and trying to avoid linking because links / websites can change. I was going to leave this as a comment, but don't have enough rep.
Update
It is a known issue, tracked here:
https://github.com/facebook/react-native/issues/19774
I resolved it by running following steps
In the root of the project, run npm install or yarn - install packages
cd node_modules/react-native - go to node modules directory
scripts/ios-install-third-party.sh - install # node_modules/react-native/third-party
cd third-party - go to newly created third party directory
cd glog-0.3.x - ls -la to find your directory version number or just use tab to auto-complete)
./configure - run setup
cd ../../../../ - change back to your project directory
react-native run-ios or react-native run-android - deploy
If any of these solution does not work, please check your project path. Project path and/or directory names should not contain any
space in its name or you can create project on Desktop or in Documents
directory.
Because of invalid name in project path, React Native project unable to link / add glob header files inside project / workspace.

No bundle URL present (react native)

Just installed react native and trying to get Hello World up and running. Been receiving this error for the last few hours:
"No bundle URL present.Make sure you're running a packager server
or have included a .jsbundle file in your application bundle."
I've referred to this: What means of no bundle URL present in react-native? and other similar questions, and tried everything: using my ip addresse, different combos of react-native run-iso and npm install while running and not running, tried deleting builds, cleaning project, restarting Xcode, simulator multiple times, tried react-native-upgrade, edited into.plist to allow arbitrary loads, manually setting the path to my index.ios.js, everything, and nothing works.
I noticed many ran into this issue when trying to build on their device. i'm not trying to do anything fancy, just get 'hello world' up and running.
Any other solutions I am not aware of?
cd into YOUR_PROJECT/ios and rm -r build, then run again react-native run-ios
I have the same issue, my problem was with info.plist I just
config it as the following:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
<key>NSAllowsLocalNetworking</key>
<true/>
</dict>
from this solution https://stackoverflow.com/a/48471978/1627358
And then add Bash config file .bashrc with this command:
echo "alias rni=\"kill \$(lsof -t -i:8081); rm -rf ios/build/; react-native run-ios\"" >> ~/.bashrc; source ~/.bashrc
Then run rni
from this solution https://stackoverflow.com/a/44080527/1627358
And it works fine with me.
run the following code:
killall -9 node
rm -rf ios/build
react-native run-ios
it will open launchpackager.command and the application will install on the ios simulator
The solution that worked for me.
You need to run:
yarn start
And at the same time (in a different terminal window):
yarn run:ios
Assuming that you are using nvm and multiple versions of node installed, here is the solution:
Say that you run npm install -g react-native-cli in node v6.9.5.
Now make node v6.9.5 as default by running nvm alias default 6.9.5
Now run react-native run-ios
The problem is, you have multiple versions of node installed via nvm and to install react-native-cli you have switched or installed latest version of node, which is not marked as default node to point in nvm yet. When you run react-native run-ios this opens up another new terminal window in which default nvm is not pointed to the node version where you have installed react-native-cli. Just follow the above setup, I hope that should help.
Answered the same here: https://stackoverflow.com/a/45267703/1292050
I had this issue after I run the following commands to clean the project to see the changes which were invisible because of the cache and so on:
watchman watch-del-all
rm -rf node_modules && npm install
rm -rf /tmp/metro-bundler-cache-* or npm start -- -- reset-cache
rm -rf /tmp/haste-map-react-native-packager-*
The reason for the issue was in the comment in dom-structure which didn't let the application run on the device. So, check the comments too ;)
faced similar issue while running in real device app was getting crash after uploading to testflight upload and install folks this issue is killer
saved by this link
https://onexlab-io.medium.com/no-bundle-url-present-fixed-ca2688a80f66
The solution that worked for me.
> sudo vim /etc/hosts
add
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
then
> sudo killall -HUP mDNSResponder
the reason is I change hosts
I had the same issue happen to me not too long ago. It appears that if you renamed the project to something else and the project folder itself was renamed, you need to make sure you replace all instances of the old name with the new name and do not forget to change file names of your .xcscheme in ProjectName > ios > ProjectName.xcodeproj > xcshareddata > xcschemes. I also had to remove the build directory. Hope this works for you as well!
I've run into this issue when I tried to sync my files to iCloud Drive. I have no idea what causes this, but as soon as I turn off my iCloud Drive and reinstall brew and Node, it started to work again. I can only think that when I turned on iCloud Drive, I might have ended up having two different Node versions or any other dependency.
To debug, your best first step is to scroll through the log text that outputs in the terminal window where you fired off "npx react-native run-ios" and search for the word like "error" or "failed". This will point you toward something more specific than the general "No bundle URL present" error.
For example, you might see something like "BUILD FAILED The following build commands failed: ProcessInfoPlistFile". In this example, I'd then know to go check on my Info.plist. You might see something different, but the debug methodology would still be the same.
If you are trying to run iOS, another idea is to build your app with Xcode itself by opening <YOUR_PROJECT_NAME>.xcworkspace with Xcode, then review its error messages.
Similarly, if you are trying to run Android, then try running with Android Studio and review its error messages.
Lots of answers are given, but one thing you should surely be taking care of while facing this issue is to
make sure that your Metro server is running.
npx react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'
Try This, clear project, and run in xCode.
This relates to the answers from #Daria Kozlova and #Daniel Twork
I needed to have the server running in another tab, i.e. yarn start
But what I hadn't noticed is that the server had crashed with an error like:
jest-haste-map: Watchman crawl failed. Retrying once with node crawler.
Usually this happens when watchman isn't running. Create an empty `.watchmanconfig` file in your project's root folder or initialize a git or hg repository in your project.
Error: Watchman error: std::__1::system_error: open: /Users/anentropic/Documents/Dev/Work/myproject/mobile-app: Operation not permitted. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.
...
watchmanResponse: {
error: 'std::__1::system_error: open: /Users/anentropic/Documents/Dev/Work/myproject/mobile-app: Operation not permitted',
version: '2022.09.12.00'
}
The fix for that can be found here:
https://github.com/facebook/watchman/issues/977#issuecomment-1189903929
i.e. run:
watchman watch-del-all
watchman shutdown-server
and then yarn start again
react-native run-ios works now
just try,
npm start
npm react-native run-ios
The below solved the same problem i had
brew update
brew reinstall watchman
Edit /etc/hosts
127.0.0.1 localhost
this is work for me !!!