Some Common Errors During React-Native Project Run
👉 Error. 1) How to Solve Error unable to resolve dependency tree during running command npm install
Solution : npm install --legacy-peer-deps
This command will help you to install all peer dependencies
👉Error. 2) Whenever you get any unexpected error
Solution : Try cd android && ./gradlew clean then cd.. npm cache clean --force then react-native run-android This will unistall debug and anykind of keystore previously generate too . So be aware before performing this step .
👉Error.3) Could not determine the dependencies of task ':app:installDebug'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at 'C:\Users\Username\react native projects\Project_name\android\local.properties'.
Solution : This error occurs when you do not have local.properties file in 'C:\Users\Username\react native projects\Project_name\android\'
create a file called local.properties at 'C:\Users\Username\react native projects\Project_name\android\'
add line
sdk.dir = C:\\Users\\Username\\AppData\\Local\\Android\\Sdk
👉Error .4) > Task :app:installDebug FAILED
Skipping device 'RZ8N90DZ5FB' (RZ8N90DZ5FB): Device is OFFLINE.
Solution : This error arises when your connected device through USB is offline . Try Restarting your phone or disable and enable back usb debugging option
👉Error. 5) return new RegExp(
^
SyntaxError: Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class
in file blacklist.js
Solution : you have to make change in this file {project_root}\node_modules\metro-config\src\defaults\blacklist.js
there is an invalid regular expression that needed changed. I changed the first expression under sharedBlacklist
from:
var sharedBlacklist = [
/node_modules[/\\]react[/\\]dist[/\\].*/,
/website\/node_modules\/.*/,
/heapCapture\/bundle\.js/,
/.*\/__tests__\/.*/
];
to
/node_modules[\/\\]react[\/\\]dist[\/\\].*/,
/website\/node_modules\/.*/,
/heapCapture\/bundle\.js/,
/.*\/__tests__\/.*/
];
0 Comments