React-native: unable to load script make sure you are either running a metro server .... ( fresh project😑 )

Created on 19 Nov 2019  Â·  9Comments  Â·  Source: facebook/react-native

React Native version:

info Fetching system and libraries information...
System:
    OS: Windows 10
    CPU: (6) x64 Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz
    Memory: 4.89 GB / 15.95 GB
  Binaries:
    Node: 13.1.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.17.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.12.1 - C:\Program Files\nodejs\npm.CMD
  IDEs:
    Android Studio: Version  3.4.0.0 AI-183.6156.11.34.5692245
  npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: 0.61.4 => 0.61.4

Steps To Reproduce

  1. as the documentaion said :) npx react-native init AwesomeProject
    then i got
 Run instructions for Android:
    • Have an Android emulator running (quickest way to get started), or a device connected.
    • cd C:\Users\xxx\Desktop\AwesomeProject && npx react-native run-android

so my second command was cd C:\Users\bader\Desktop\AwesomeProject && npx react-native run-android

it start building until it finished
then unable to load script make sure you are either running a metro server run react-native start

since 3 years until today, whenEver i decide to learn react native I got such silly bugs, because of that i kept leaving it behind and learn something else .
come on, if the initial installation process has an issue , then how the code itself is going to be ?
my friends are working on mac and they told me they have no issue there, unless they use windows !!!!
i was following each step in the documentaion, so everything should be fine as usual

installation process that i did are same as the fucking documentaion said

image

image

image

Bug

Most helpful comment

Same happens following exact same steps but using TypeScript template. There is a way to solve for both though, temporarily.

Go to your root folder of the project > node_modules > metro-config >src > defaults >blacklist.js.

Open said file (VS Code, etc) and on the top you will see a var called SharedBlacklist. Change that var from what it is to what my attached txt says, which I got from GitHub also but can't find from whom to give credit.

It works like normal with that fix.

blacklist.txt

It is a fairly critical bug considering it appears on a clean project, hope it gets fixed soon.

All 9 comments

Same happens following exact same steps but using TypeScript template. There is a way to solve for both though, temporarily.

Go to your root folder of the project > node_modules > metro-config >src > defaults >blacklist.js.

Open said file (VS Code, etc) and on the top you will see a var called SharedBlacklist. Change that var from what it is to what my attached txt says, which I got from GitHub also but can't find from whom to give credit.

It works like normal with that fix.

blacklist.txt

It is a fairly critical bug considering it appears on a clean project, hope it gets fixed soon.

Perfect its work like charm.
Thanks Juan-Castelli

yes it works , thanks @Juan-Castelli I hope i'm not gonna face this kind of bugs again 😥

@Juan-Castelli it works, thanks

This worked for me, but when i run "react-native start", the command prompt returns this error:

error Invalid regular expression: /(.\__fixtures__\.|node_modules[\]react[\]dist[\].|website\node_modules\.|heapCapture\bundle.js|.\__tests__\.)$/: Unterminated character class. Run CLI with --verbose flag for more details.
SyntaxError: Invalid regular expression: /(.\__fixtures__\.|node_modules[\]react[\]dist[\].|website\node_modules\.|heapCapture\bundle.js|.\__tests__\.)$/: Unterminated character class
at new RegExp ()

That's weird. You running from a clean project?

That's weird. You running from a clean project?

Yes, I already found the solution, it was just a bug in Metro Bundler.
Thanks for support

Thank you for your report. We fixed this just now with the release of Metro 0.56.4 and 0.57.0. Update your packages and re-create your project and things should work for you again :) Sorry for the inconvenience.

This keep happening to me, every time I install a new dependency...

Doing the replacement of the blacklist.js file fixes it every time too, but it's a pain in the @$$.

Was this page helpful?
0 / 5 - 0 ratings