27

I'm using expo-cli 2.6.14, react-native 0.57.1, Expo SDK 31.0.0. In order to start the project to run on the Expo app, I use expo start. Sometimes it works, sometimes I get an error and I have no idea why. If I just keep running expo start over and over again, eventually it will work, but that's a lot of wasted time.

This is the error that I get:

Could not get status from Metro bundler. connect ECONNREFUSED 127.0.0.1:19001
Connecting to Metro bundler failed.
Set EXPO_DEBUG=true in your env to view the stack trace.
error Command failed with exit code 1.

I'm not sure why this happens. I've been ignoring it since it doesn't happen consistently, but it's become a nuisance. Any thoughts on what the issue might be?

Edit: This is a known issue that still has not been fixed.

Edit 2: Still occurring with expo-cli 2.12.2, and Expo SDK 33.0.0

Zaytri
  • 2,582
  • 2
  • 13
  • 19

16 Answers16

64

I faced this issue too, here is what I did finally:

First try to use "expo start -c" to clear the cache when launching, this is the option that works every time.

Try to delete your .expo folder if it doesn't work and retry.

Zaytri
  • 2,582
  • 2
  • 13
  • 19
amir_muerte
  • 656
  • 6
  • 3
7

For whatever reason, this is the solution that works almost 100% of the times for me.

  • expo start
  • Ctrl + C
  • expo start
fedorqui
  • 275,237
  • 103
  • 548
  • 598
Zaytri
  • 2,582
  • 2
  • 13
  • 19
7

I followed below steps:

  1. Run expo start
  2. Ctrl + c
  3. Delete .expo folder in your project directory
  4. Run expo build:android -c

⚠️expo build:android will be discontinued on January 4, 2023⚠️

Maifee Ul Asad
  • 3,992
  • 6
  • 38
  • 86
user3016257
  • 81
  • 1
  • 5
6

Try removing the .expo directory from the project root.

Idan
  • 3,604
  • 1
  • 28
  • 33
2

I was getting the same error. I resolved it by deleting the .expo folder in the root of my project

Colyn Brown
  • 508
  • 1
  • 5
  • 11
2

First of all you have to start expo

expo start and after build your project

expo publish

use this two command it is worked for me.

1

I have recently created an app in react-native and I used command "expo build-android" for creating the Android APK.It even worked for me most of the times but not always, so the solution I used is (might be helpful to someone else) -

  1. Run command "npm install -g expo-cli" and this throws an error - "expo is unrecognised as internal and external commands"
  2. Search for "environment variables”(Press windows key to search on Windows OS) and add a new path to system variables "C:\Users\test\AppData\Roaming\npm" you might have different folder at the place of "test", use that here.
  3. Run "npm install -g expo-cli" and it should work fine.
  4. Run "expo build:android" if it still gives the same error then run 3 commands in command prompt (now go to the project path then run these 3 commands one after another) step-1: expo start step-2: ctrl+c (to stop it) step-3: expo build:android It’s not clear to me as to why this works and how I came to this solution but its working.
Ayushi Jain
  • 342
  • 4
  • 13
0

Also, check what 19xxx ports are being used by what applications. You can do so by running 'expo start -c' from one terminal and run 'netstat' and 'lsof' commands from another terminal. You can kill other processes if they're using any of 19xxx ports.

HTH,

chuck
  • 125
  • 3
  • 16
0

Specific situation but I found out that Laravel Valet running in the background was causing me to consistently get the ECONNREFUSED 127.0.0.1:19001 error.

Running valet stop before expo start seemed to fix it.

brianjohnhanna
  • 343
  • 4
  • 12
0

Open a new terminal.
Write ipconfig, you'll get IP4 address like: 192.168.........
Copy this address and run this:
set REACT_NATIVE_PACKAGER_HOSTNAME=(paste you ip4 address here)
Now run: expo start
Open split terminal and run: expo build:android

Happy coding :)

סטנלי גרונן
  • 2,917
  • 23
  • 46
  • 68
0

Delete your .expo folder as it is recommended in the expo documentation

Worked very well for me.

Cyril
  • 134
  • 1
  • 4
  • 15
0

run #rm -rf .expo in your project folder

Eric
  • 940
  • 12
  • 27
0

Adding some additional info...

Like others stated, I tried doing the expo start then ctrl+c. It seemed to work at first, but then my build failed with

EPERM: operation not permitted, rename 'mypath\.expo\packager-info.json.1807243929' -> 'mypath\.expo\packager-info.json'

So then I removed .expo like the others and then my build worked.

IronYeti
  • 73
  • 7
0

Just delete the .expo file from your root directory of the project and run the command Don't Touch The .expo-shared file

expo android:build
0

In my case worked when I closed another process.

make sure you don't have antoher process running in the same port, it worked for me.

OscarGM10176
  • 57
  • 1
  • 9
0

An alternative to solving problems like this is to find out what is using the port in question.

Try on Windows

netstat -o -n -a | findstr 127.0.0.1:19001

In the last column it will show a PID code, write it down.

Press Windows + R and type

taskmgr

The task manager will open, go to the service area and look for the PID you wrote down earlier and when you find it, end the process.

After that try to run a build.