27

I'm using react-native getting started tutorial for creating new rn app.after installations when I try to run my just created app I'm getting this error:

unable to load script from assets index.android.bundle

after lot's of research about this lead me to do bundle but when I do bundle with this command

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

I'm getting this error:

SHA-1 for file c:\Users\mehrdad\Desktop\WorkSpace\ReactNative\awesomeproject\index.js is not computed

And my problem still exists

"react": "16.4.1",

"react-native": "0.56.0",

"windows 8.1"
Robert Andrzejuk
  • 5,076
  • 2
  • 22
  • 31
Mehrdad Mohammadi
  • 373
  • 1
  • 4
  • 7

11 Answers11

48

I updated react-native-cli and the problem disappeared :

npm i -g react-native-cli
Yairopro
  • 9,084
  • 6
  • 44
  • 51
16

Ran into the same issue when using the react-native to run the mentioned command directly.

Running the same command with npx solved it for me. Try running the below and see if that helps.

npx 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
10

For me, I was using react-native start when I normally use npx react-native start, using npx fixed the issue!

Micheal C Wallas
  • 495
  • 6
  • 14
9

My issue was that I tried to require a file with the proper path but incorrect capitalization.

Evan Norton
  • 91
  • 1
  • 4
6

If the error also includes metro-bundler not working, try restart your system. I restarted my system and it worked for me.

6

Again start metro bundle i.e react-native start and then working

3

Just terminate your current Metro bundler process and start a new Metro bundler. Worked for me!!

Krishna
  • 5,194
  • 2
  • 28
  • 33
1
npm i -g react-native-cli

update your react native CLI globally. enter image description here

SHR
  • 7,940
  • 9
  • 38
  • 57
1

my issue was that my --entry-file app.js was supposed to be --entry-file App.js.

I corrected that and it worked for me.

insaineyesay
  • 336
  • 2
  • 7
0

I had the same issue and none of the above suggestions worked for me. Going to src -> app -> App.js and changing App.js to app.js fixed the issue.[side panel1

0

For completion, I had the same issue. In my case, it was due to the location of the project having a symlink as one of its parent.

malavv
  • 553
  • 1
  • 5
  • 14