The manual shows how to resolve the compatibility errors between Node.js and Windows OS
There are some compatibility issues between the latest version of Node.js and Windows OS. As a result, it isn't possible to run the React Native commands on Windows. It affects the proper work of the Android Studio as well. To fix all the compatibility issues, you need to follow the instructions step by step.
Run all these commands one by one in your CMD:
npm install -g react-native-cli
npm install —save-dev jetifier
npx react-native start
After, you will get this kind of error in the CMD:
To avoid that error, please go to this folder ".../motors-app/node_modules/metro-config/src/defaults/" and edit the "blacklist.js" file in your code editor. In that file, change the incorrect sharedBlacklist expression.
var sharedBlacklist = [/node_modules[/\\]react[/\\]dist[/\\].*/,/website\/node_modules\/.*/,/heapCapture\/bundle\.js/,/.*\/__tests__\/.*/];
var sharedBlacklist = [/node_modules[\/\\]react[\/\\]dist[\/\\].*/,/website\/node_modules\/.*/,/heapCapture\/bundle\.js/,/.*\/__tests__\/.*/];
Then, open your CMD and press Ctrl+C to terminate the process. After, run the npx react-native start command once again.
Next, open the ".../motors-app/android" project in the Android Studio. If there is the following error:
Click Android Studio > Preferences > Experimental and Only sync the active variant option.
Finally, set up your app configurations like application name, icons, Google AdMob and push notification integrations according to this manual.
If there is the following error in CMD when you run the Android Studio Emulator:
> Task :react-native-maps:generateDebugBuildConfig FAILEDFAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':react-native-maps:generateDebugBuildConfig'.> java.io.IOException: Unable to delete directory ...\node_modules\react-native-maps\lib\android\build\generated\source\buildConfig\debug.
You need to open the build.gradle (Module: app) file in your Android Studio and set up dependencies in 161 line exactly in this order:
After, run this command:
cd android && gradlew clean && cd .. && react-native run-android
All the actions above should resolve the compatibility issues on Windows and allow you to correctly build your Android app.