[React-Native] 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 에러

nana·2024년 5월 20일
1

React-Native

목록 보기
3/3

오류내용

npx react-native run-android를 통해 React-Native를 실행했더니 아래와 같은 오류가 발생했다.

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.

해결방법

1. android/app/src/main/assets/모든 파일삭제

-> 내 경우엔 assets폴더가 없어서 생성해주었다.

2. 아래 명령어 입력

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle

3. index.android.bundle 파일 생성여부 확인

android/app/src/main/assets/index.android.bundle


파일이 잘 생성되었고 오류도 해결되었다.

profile
프론트엔드 개발자 도전기

0개의 댓글