What to do if react native red screen error occurs

藏色散人
Release: 2023-01-04 16:46:34
Original
2943 people have browsed it

React native red screen error solution: 1. Create the folder assets in "android/app/src/main/"; 2. Execute the command "react-native bundle --platform android --dev false --entry-file index.android.js..."; 3. Execute "react-native run-android" in the project.

What to do if react native red screen error occurs

The operating environment of this tutorial: Windows 10 system, React Native version 0.67, Dell G3 computer.

What should I do if react native reports a red screen error?

Red screen error when react-native starts: Unable to load script.Make sure you're either running a metro server or that ....

1. Error message content

I got this error when I started the react-native project in Android Studio

1. Error message:Unable to load script.Make sure you're either running a metro server ( run 'react-native start' ) or that your bundle 'index.android.bundle' is packaged correctly for release.

2. Chinese translation: Unable to load script. Please make sure you are running Metro server (run 'react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.

2. Reason

index.android.bundle Does this file exist?

I searched globally for this file in the editor and could not find it

3. Solution

1. Create the folder assets

in the project in android/app/src/main/ 2. Execute the command in the project

react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
Copy after login

*Note: Check whether your project has the file index.android.js. If so, press Enter to execute the command. Otherwise, an error will be reported and cannot be found. This index.android.js file; Change index.android.js to index.js

##After executing this command, it will be in the newly created assets folder Generate an index.android.bundle file

3. Execute react-native run-android in the project and start successfully

4. After successful startup

Modify the content in App.js and refresh the simulator to see if Modify; the Android emulator reload menu interface displays the shortcut key ctrl M;

Recommended learning: "

react video tutorial"

The above is the detailed content of What to do if react native red screen error occurs. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!