React Native Config.h not found - javascript

I'm beginner of React native developer.
After create new project then open it.
xcode is display error config.h file not found in mutex.h file. I'm also search in google and try possible solution but still display same error.
I'm done Following Commands
1
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2
brew install watchman
3
npm install -g react-native-cli
4
react-native init projectName
5
cd projectName
react-native start
6
react-native run-ios
Error in CMD
./Desktop/Demo React Native/projectName/node_modules/react-native/React/../third-party/glog-0.3.4/src/base/mutex.h:105:10: fatal error: 'config.h' file not found
include "config.h" // to figure out pthreads support
1 error generated.
Software Version List
Homebrew 1.6.8
react-native-cli: 2.0.1
react-native: 0.55
watchman 4.9.0
npm 6.1.0
I'm also try this soluation but still error
In the Terminal, navigate to the third-party/glog and config glog file
cd node_modules/react-native/third-party/glog-0.3.4
./../scripts/ios-configure-glog.sh

I got it fixed by following this steps:
Close Xcode.
cd <Project-Folder>/node_modules/react-native/third-party/glog-0.3.4
Run ./configure
Run make
Run make install
Open Xcode and try building the Project.
Hope this solves the issue

Solution:
yarn upgrade log
Upgrade to v1.6.0 successful. iOS build successful.
Note: Rebuilding glog did did not work for me. Build failed.

I will add another answer to this issue since it was driving me crazy this week...
$ cd ./node_modules/react-native && scripts/ios-install-third-party.sh && cd third-party && cd $(ls | grep 'glog' | awk '{print $1}') && ./configure
The steps needed to manually configure glog (like samridhgupta his accepted answer or the command I wrote here just above) worked for me, but only the first time I build the project. On every single build I had to go to the same process so I needed a more stable solution.
I appears Xcode is executing ios-install-third-party.sh on every build, which means it will also execute ios-configure-glog.sh every single time. So my solution is to just build a single time, and then comment out the glog install step in the ios-install-third-party script.
If anyone is facing this same issue, it is the line below you need to remove or comment out (ios-install-third-party can be found in /node_modules/react-native/scripts).
fetch_and_unpack glog-0.3.5.tar.gz https://github.com/google/glog/archive/v0.3.5.tar.gz 61067502c5f9769d111ea1ee3f74e6ddf0a5f9cc "\"$SCRIPTDIR/ios-configure-glog.sh\""

If any of these solution does not work, please check your project path. Project path - directory names should not contain any space in its name or you can create project on Desktop or in Documents directory.

Run following commands in 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

Add this fix script into package.json
"scripts": {
"fix": "cd node_modules/react-native/third-party/glog-0.3.4 && ./configure && make && make install"
},
Then run yarn fix or npm run fix and then try building the Project

My problem was comming from using react-native#0.53.0, which I suppose has trouble with new Xcode version.
1 - Change react-native version in package.json
"react-native": "0.53.0",
to
"react-native": "0.56.0",
2 - Remove node_modules folder
$ rm -rf node_modules/
3 - Reinstall modules:
$ yarn install

What worked for me:
yarn cache clean
rm -rf node_modules
yarn install

Related

How to install Stencil-CLI for BigCommerce properly

I want to install Stencil-CLI for BigCommerce and got this error list:
Command failed: git submodule update -q --init --recursive
I'm using node version 12.22.9 (I've also tried version 22.7 and 22.8, but the issue was present there too); nvm version is 0.36.0.
Reinstalling nvm and/or node didn't help.
To solve this problem, just wait for response from git repo, and then it will fix itself (I just went home, and the next day I just ran this command again)

Error: Unable to resolve module `#react-native-community/toolbar-android`

Weirdly, the react-native-vector-icons was working well but by using ^ ("^6.6.0") for its version in the package.json file on the new release this error happens.
It's weird because two days ago it works well but now starting of my project ran to this error:
error: Error: Unable to resolve module #react-native-community/toolbar-android from node_modules\react-native-vector-icons\lib\toolbar-android.js: #react-native-community/toolbar-android could not be found within the project.
After reading this issue and trying many solutions I reach to two solutions:
You can delete all node_modules folder and put the version of react-native-vector-icons to "6.6.0" instead of "^6.6.0" and then install all packages again. absolutely, it is better to delete all caches and builds and start everything again. (NOT Recommended)
You can install the #react-native-community/toolbar-android by using the below command:
yarn add #react-native-community/toolbar-android
Or
npm install --save #react-native-community/toolbar-android
Note: Both of these solutions are temporary and soonly this bug will be fixed and there is no need to install the toolbar-android package.
Prev Update
I update the package to the version "^7.0.0" on my project and still, the issue is remaining, so this solution is currently perseverance.
New Update
this issue is fixed on version "^7.1.0" and there is no need to install the #react-native-community/toolbar-android.
Update the library
react-native-vector-icons
to the latest version.
I had this problem too.
In my case, only works when I removed and added the package again with the latest version (7.0.0).
yarn remove react-native-vector-icons
yarn add react-native-vector-icons
Had this EXACT same error. All I had to do was install toolbar-android & voilĂ !
npm install --save #react-native-community/toolbar-android
Go the path \node_modules\native-base\node_modules\react-native-vector-icons\lib\toolbar-android.js
Replace import ToolbarAndroid from '#react-native-community/toolbar-android' to import {ToolbarAndroid} from './react-native';
I also got the same error after upgrading from version 6 to 7. The issue can be fixed simply by resetting the cache.
Please try npm start -- --reset-cache
do this:
rm -rf node_modules/
rm -rf package.lock.json
npm i
react-native start --reset-cache
from your project directory:)
Just Import it direct from react native it solves my problem
node_modules\react-native-vector-icons\lib\toolbar-android.js
import { ToolbarAndroid } from 'react-native';
Same issue, I solved it:
My environment:
RN: 0.61.5
Node: v12.18.3
OS: Windows 10 Pro
You can install react-native-vector-icons latest version (current 7.0.0).
And do not run auto-link (react-native link react-native-vector-icons)
Finally, running react-native start --reset-cache
Good luck.
First let's understand the standard convention used in package.json for packege's version.
So if you see ~1.0.2 it means to install version 1.0.2 or the latest patch version such as 1.0.4. If you see ^1.0.2 it means to install version 1.0.2 or the latest minor or patch version such as 1.1.0.
Now, coming to the issue.
The issue is caused because you are having a version of react-native-vector-icons which is giving you some trouble.
Check it's version by this command under your project directory:
npm list react-native-vector-icons --version \ is it 6.6.0 ??
No ?? . There is the problem. You need strictly 6.6.0 but you got something else.
Solution:
Delete node_modules directory under your project. Change the version of react-native-vector-icons in package.json to 6.6.0 (basically remove ^ to tell npm to get me exactly what I want. Nothing more, nothing less !)
Then do npm install !
The other alternative is to use expo's vector Icons. Something like this.
import { Ionicons } from "#expo/vector-icons".
Then render your Icon like this;
<Ionicons
name="ios-exit-outline"
color={colors.danger}
size={28}
style={{ marginRight: -15 }}
/>
Edit this file node_modules\react-native-vector-icons\lib\toolbar-android.js
remove 'import ToolbarAndroid from '#react-native-community/toolbar-android';'
edit return null
for this case you have not toolbar-android in your modules file and as friends saying you can fix it by this command
windows users:
npm install --save #react-native-community/toolbar-android
Mac users:
yarn add #react-native-community/toolbar-android
But IN GENERAL: I wanna tell you an experience for you guys whenever you encounter with this kind of errors that start with "Unable to resolve module" .
if you have a look to the error we have a problem with the module that system is telling us.
if you have not that module . you can install it with the commands
Windows users:
npm install --save THE MODULE(attention: THE MODULE IS THE NAME OF PACKAGES OR MODULES that u need to install)
and Mac users:
yarn add THE MODULE(attention: THE MODULE IS THE NAME OF PACKAGES OR MODULES that u need to install)
for example lets look at this error:
error Unable to resolve module `#react-native-community/slider` from `App.js`: #react-native-community/slider could not be found within the project.
as you can see error is telling us this module could not be found within our project.
so we need install it with this command:
for windows programmers:
npm install --save #react-native-community/slider
and for mac programmers:
yarn add #react-native-community/slider
that's all.
I hope you understand me clearly and do not have problem with unable to resolve module errors and my command be useful for you.
best regards
Mehrad Karampour (MEH)

React Native not working after Xcode 10 update

I just upgraded to Xcode 10 and now after attempting to run my existing projects I was met with the below error. After searching I found the following issue when running react native init https://github.com/facebook/react-native/issues/21490. This solution also fixes my issue.
However I am wondering if anyone knows why my current project now require me to run the bundler as a separate instance. It's not the end of the world but it's certainly not the best experience.
Does anyone know of a way the get everything working as it was before without the need to run the following commands:
rm -rf $TMPDIR/react-; rm -rf $TMPDIR/haste-; rm -rf
$TMPDIR/metro-*; watchman watch-del-all
react-native start --reset-cache
(separate terminal) react-native run-ios
I had issues with the build after Xcode update, what I did to fix it is switch the Build System to Legacy Build System
From File > Workspace Settings
Or by pressing on the hammer icon on the right of the status bar
Change the build system to Legacy Build System
Also make sure that you still have the bundle script in Build Phases
Tell me know if that works with you
You may need to add an additional Build Phase to the xCode project after "Bundle React Native code and images"
Add a new build script by selecting the + sign on the top left and selecting "New Run Script Phase" then add the following
if nc -w 5 -z localhost 8081 ; then
if ! curl -s "http://localhost:8081/status" | grep -q "packager-
status:running" ; then
echo "Port 8081 already in use, packager is either not running or not
running correctly"
exit 2
fi
else
open "$SRCROOT/../node_modules/react-
native/scripts/launchPackager.command" || echo "Can't start packager
automatically"
fi

ng command not working [duplicate]

I am trying to create a project (named ngadmin) via the angular cli but it throws errors on this command: ng new ngadmin. The errors are:
fs: re-evaluating native module sources is not supported. If you are
using the graceful-fs module, please update it to a more recent
version.
You cannot use the new command inside an angular-cli project.
I am not sure what the problem is as this cli was working fine for me a few days ago.
Check in your username folder, if there is package.json and node_module exist. If they are there then delete them.
Notice: you may have created an angular project in your home/username directory. If you delete them it will work.
If using Linux, go to home and delete package.json.
I had this problem as well. Here is how I fixed it:
Go to package.json
Under "Dependencies", find "angular-cli": "^1.0.0-beta.18"
Delete this line ("angular-cli": "^1.0.0-beta.18")
Save file
Hope that helps!
The first warning regarding graceful-fs is due to the fact that angular-cli uses older version of graceful-fs pkg, nothing to worry about that.
The error "You cannot use the new command inside an angular-cli project" signifies you are inside an angular cli project, get out of the angular cli project using cd .. command and try running the command ng new ngadmin it will work.
there is a file package.json
Simply remove it and then Create project.
it will work for sure
Seems like i fixed my problem. I have no idea what happened but i noticed system32 was not in my PATH so i added that and uninstalled and reinstalled the angular-cli package. everything works like a charm now
I had the same issue, the thing was I was not closely following along the tutorial I was watching and I tried using the same directory, I used cd .. to move up in the file structure and it worked like a charm, hope this helps!
i had the same problem today, I started a fresh project and did
npm install -save #angular/cli
and received the error.
I just renamed the package.json to .json2 temporarily and it worked.
Delete the file package.json in current directory where you are trying to create. Then try to install again.
In windows cd/User,Find the package.json,package-lock.json file and delete both the files.
Restart your command prompt and you are ready to go.And try to use this command
npm install --save-dev #angular/cli#latest
You must have used local "npm install #angular/cli" command to install angular locally in your project.
Uninstall local angular using "npm uninstall #angular/cli"
install angular globally using "npm install -g #angular/cli"
and then try "ng new ngadmin"
Because "ng new projectName" will automatically install angular/cli locally as a dev-dependency

Angular JS 2 can't be installed, why?

I have tried setting up Angular 2 to experiment with on my VPS. The needed steps are here:
https://angular.io/docs/js/latest/quickstart.html
The first command is successful:
$ npm install -g tsd#^0.6.0
But the second step causes an error:
tsd install angular2 es6-promise rx rx-lite
"/usr/bin/env: node: No such file or directory" is the error I get. I have tried installing this in my project folder as root, but that also didn't had success. Does someone know why I get this error? The command doesn't exist, but why not?
Is there an easier way to install this? I have seen "npm install angular2", but I don't know how that works, that's why I tried the steps
You may need to make a symbolic link to node:
ln -s /usr/bin/nodejs /usr/bin/node
(see https://stackoverflow.com/a/26320915/2033574)

Categories