React-native: "run-android" stuck on JS Metro Bundler ("warn")

Created on 1 Aug 2019  路  31Comments  路  Source: facebook/react-native

Today I created a new project with "react-native init projectName" and when I tried to "run-android" it runs Node JS server and stucks like first screenshot.

If I kill the JS server it gives the warn about packager server and contiunes to install app and gives Unable to load script error (for sure because JS server not running)

When I first type "react-native start" and "run-android" it works fine, but I want to know why it happens like that? I search that warn error and can't find anything.

It's start happening suddenly. I didn't recieve that error on my old projects (same react and react native versions) and don't know why it happens.

Any help?

1
2

Error:

warn Failed to automatically start the packager server. Please run "react-native start" manually. Error details: Command failed: cmd.exe /C C:\Users\ezran\Desktop\SADELABS\demoProject\node_modules\react-native\scripts\launchPackager.bat
nullnull

package.json

"react": "16.8.6", "react-native": "0.60.4"

System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
    Memory: 2.63 GB / 7.88 GB
  Binaries:
    Node: 10.16.0 - C:\Program Files\nodejs\node.EXE
    npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
  IDEs:
    Android Studio: Version  3.4.0.0 AI-183.6156.11.34.5692245
Bug Android 馃摝Bundler

Most helpful comment

i have got the solution of the problem

  1. go to your project and run 2 command shell
  2. in first shell, run npm start
  3. in second shell, react-native run-android
    then it will run

All 31 comments

Can you run react-native info and edit your issue to include these results under the React Native version: section?

If you believe this information is irrelevant to the reported issue, you may write [skip envinfo] alongside an explanation in your Environment: section.

Can you run react-native info and edit your issue to include these results under the React Native version: section?

If you believe this information is irrelevant to the reported issue, you may write [skip envinfo] alongside an explanation in your Environment: section.

I updated

Same problem, I tried to reinstall node, clear npm cache, etc ...

Same problem, how to solve the issue?

Same problem too ! (tried to reinstall node, used yarn or npm, cleared cache and so on)

Same problem too, please help

I am also having this issue too!

"dependencies": { "react": "16.8.6", "react-native": "0.60.4" }

System: OS: Windows 10
CPU: (12) x64 AMD Ryzen 5 1600 Six-Core Processor
Memory: 5.95 GB / 15.95 GB
Binaries:
Node: 10.16.0 - C:\Program Files\nodejs\node.EXE
npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
IDEs: Android Studio: Version 3.4.0.0 AI-183.6156.11.34.5692245

and i have made the refactor to AndroidX and use JETIFIER

and it does not even compile my app on an Android Emulator, it just get stuck in the metro bundler, like the image for example.

I recently upgraded to react native 0.60.4 using this tool

https://react-native-community.github.io/upgrade-helper/?from=0.59.8&to=0.60.4

Same problem

similar issue here as well

@ezranbayantemur This seems to be an issue with the CLI. I suggest you open an issue there.

@ezranbayantemur This seems to be an issue with the CLI. I suggest you open an issue there.

But same (version) CLI runs older projects (just created a week ago, not different) perfectly. I don鈥檛 think problem about CLI.

@ezranbayantemur what's your CLI version? Check using yarn list @react-native-community/cli.

same problem,Please help me

Same here

This was an issue with the CLI. Fixed in #604. Please wait for the new CLI release (happens quickly) and then update.

As a workground, just downgrade your CLI to 2.8.0 or lesser and it will work without an issue. Upgrade/Downgrade instructions here

When I init my project at react-native version 0.59.3 again. The problem is gone.

i have got the solution of the problem

  1. go to your project and run 2 command shell
  2. in first shell, run npm start
  3. in second shell, react-native run-android
    then it will run

@san003 RN versions less than 0.60 use 1.0+ versions of CLI which don't have the bug. RN Version 0.60+ uses 2.0+ version of CLI.

@ezranbayantemur what's your CLI version? Check using yarn list @react-native-community/cli.

When I was command "react native -v"

react-native-cli: 2.0.1 react-native: 0.60.4

If CLI is the problem how can work on older project? I mean it can be, maybe I was wrong, CLI has problem, but I don't get it. I have two project which one of them created one week ago (0.60.4), one of them yesterday (0.60.4), older one works fine but the other has a problem.

@ezranbayantemur that's the global-cli version. Run the command i gave you.

If CLI is the problem how can work on older project? I mean it can be, maybe I was wrong, CLI has problem, but I don't get it. I have two project which one of them created one week ago (0.60.4), one of them yesterday (0.60.4), older one works fine but the other has a problem.

Compare the CLI versions of both the projects using the command I gave you and you will see the difference. Each time you run react-native init, the latest CLI version is installed (locally not globally).

Edit: And I fixed it in the CLI so it is of course a problem with the CLI. Try the workaround I gave above until a new CLI release is published.

If CLI is the problem how can work on older project? I mean it can be, maybe I was wrong, CLI has problem, but I don't get it. I have two project which one of them created one week ago (0.60.4), one of them yesterday (0.60.4), older one works fine but the other has a problem.

Compare the CLI versions of both the projects using the command I gave you and you will see the difference. Each time you run react-native init, the latest CLI version is installed (locally not globally).

Yeah you were right, older project has "@react-native-community/[email protected]", newer one " @react-native-community/[email protected]".

Sorry for not thinking problem on CLI, my bad. I don't know very well CLI

Mine is started working, just I had to do one more step.

  1. npm start
  2. react-native start
  3. react-native run-android

This was an issue with the CLI. Fixed in #604. Please wait for the new CLI release (happens quickly) and then update.

As a workground, just downgrade your CLI to 2.8.0 or lesser and it will work without an issue. Upgrade/Downgrade instructions here

I downgrade it but still has same error.

I remove @react-native-community/cli entry on package-lock.json and npm install @react-native-community/[email protected] but still nothing changes.

Also I checked with list command and :

+-- @react-native-community/[email protected]
-- [email protected]
-- @react-native-community/[email protected] deduped

@ezranbayantemur run npm install --dev @react-native-community/[email protected] or yarn add --dev @react-native-community/[email protected]

The issue is being worked on here: https://github.com/react-native-community/cli/pull/604. Should be fixed soon. Closing this one.

Published fix in v2.8.3 of the CLI. Please update the @react-native-community/cli to the latest version.

Published fix in v2.8.3 of the CLI. Please update the @react-native-community/cli to the latest version.

Still happening here with 2.8.3. Tried to reinstall it, tried through npx, tried many times to create a project from scratch. No success. Node version: 8.13.0.

having the same issue with 2.9.0. Someone running 2.0.1 doesn't have that problem. Any advice on how to debug this?

$ react-native info
warn The following packages use deprecated "rnpm" config that will stop working from next release:
  - react-native-maps: https://npmjs.com/package/react-native-maps
Please notify their maintainers about it. You can find more details at https://github.com/react-native-community/cli/blob/master/docs/configuration.md#migration-guide.
info Fetching system and libraries information...
System:
    OS: Linux 5.2 Arch Linux undefined
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    Memory: 1.77 GB / 15.45 GB
    Shell: 5.0.7 - /bin/bash
  Binaries:
    Node: 11.15.0 - /usr/bin/node
    Yarn: 1.17.3 - /usr/bin/yarn
    npm: 6.10.3 - /usr/bin/npm
  SDKs:
    Android SDK:
      Android NDK: 20.0.5594570
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5692245
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.4 => 0.60.4 
  npmGlobalPackages:
    react-native-cli: 2.0.1

EDIT: @rabingithb's answer worked though...

Well for my solution
i just installed react-native with the latest version with this command and everything works fine!

npx react-native init MyTestApp

i was facing the issue , my server used to stop, every time , but then i have changed the port and the issue has resolved now ,
npx react-native start --port=8088

Was this page helpful?
0 / 5 - 0 ratings