In this blog, we are going to see some common errors that we may face as beginners to React Native.
It is prerequisite that React native is already set up on our machine. If it is not, please go through this article:
Whenever I start any new programming language or framework I get stuck on things andI wish that issue would never come again, but in fact, it always comes.
I am writing this blog based on the most common headaches and issues/errors that I get stuck on in React Native.
This article will surely help you to find a simple solution or trick as well to resolve these issues/errors.
Issues
Step 1
In the project directory, create assets folder,
- mkdir android/app/src/main/assets
Step 2
Do bundling project file. Please enter this in the command prompt,
- react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
Step 3
Run project for Android,
Step 1
Clear watchman watches.
Step 2
Delete the `node_modules` folder.
- rm -rf node_modules && npm install
Step 3
Reset Metro Bundler cache.
- rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache
Step 4
Remove haste cache.
Open Command Prompt from path project name (root path):
Step 1
A forced clean cache of npm.
- del %appdata%\Temp\react-native-* & cd android & gradlew clean & cd .. & del node_modules/ & npm cache clean --force & yarn install & react-native run-android
Step 2
Installing React package.
- npm install --save react@*
Step 3
Installing React navigation.
- npm install react-navigation@https:
Conclusion
This is how we can sort out these common issues in React Native.
I hope you like this blog.