connect ECONNREFUSED - Connecting to Metro bundler failed.

Hey everyone, I’ve been having this issue for quite a long time now, I’ve seen a lot of people asking for the same problem here, tried everything but still doesn’t work.

I’ve tried uninstalling node, expo-cli, deleting .expo, closing all local ports, but it just keeps showing this error. Here’s the full log of the erro:
ps. I’m using Mac and I used to have flutter installed, don’t know if that can cause any possible errors.

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm@6.13.4
3 info using node@v12.14.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle @~prestart: @
6 info lifecycle @~start: @
7 verbose lifecycle @~start: unsafe-perm in lifecycle true
8 verbose lifecycle @~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/lucas/Desktop/Coding/ReactNative/Project/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/lucas/Desktop/flutter/flutter/bin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/lucas/.npm-global/bin:/Users/lucas/.npm-global/bin
9 verbose lifecycle @~start: CWD: /Users/lucas/Desktop/Coding/ReactNative/Project
10 silly lifecycle @~start: Args: [ '-c', 'expo start' ]
11 silly lifecycle @~start: Returned: code: 1  signal: null
12 info lifecycle @~start: Failed to exec start script
13 verbose stack Error: @ start: `expo start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:223:5)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:223:5)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid @
15 verbose cwd /Users/lucas/Desktop/Coding/ReactNative/Project
16 verbose Darwin 18.7.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
18 verbose node v12.14.1
19 verbose npm  v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error @ start: `expo start`
22 error Exit status 1
23 error Failed at the @ start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Does anyone know how to solve this??

Hey @lucasheise,

Can you run expo diagnostics and paste what’s printed out here? Also, has the expo-cli worked before for you on this machine or has it yet to?

Cheers,
Adam

1 Like

Hey @adamjnav, thanks for the reply, expo-cli has worked normally before (and it worked for quite a while) and suddenly started doing this.

ps. I forgot to mention that I’ve also tried to delete all my node_modules and run npm install, but didn’t work as well .

Here’s my expo diagnostics:

Expo CLI 3.24.0 environment info:
    System:
      OS: macOS Mojave 10.14.6
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 12.14.1 - /usr/local/bin/node
      Yarn: 1.22.4 - /usr/local/bin/yarn
      npm: 6.13.4 - /usr/local/bin/npm
    IDEs:
      Android Studio: 3.5 AI-191.8026.42.35.6010548
      Xcode: 11.2/11B52 - /usr/bin/xcodebuild
    npmPackages:
      expo: ~38.0.8 => 38.0.9 
      react: ~16.11.0 => 16.11.0 
      react-dom: ~16.11.0 => 16.11.0 
      react-native: https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz => 0.62.2 
      react-native-web: ~0.11.7 => 0.11.7 
    npmGlobalPackages:
      expo-cli: 3.24.0

Thanks in advance

@adamjnav any news??

I encounter this econnrefused issue as well.
For me it doesnt help to remove the .expo folder.

Im not sure if it is the same for you as for me.
When I publish my package i get this error, when I publish again straight after, I do not get the error and can successfully publish the package.
Each time u run the code, the first publish will fail with econnrefused but after that it succeeds.

Would still love to fix this but as long as it works on second try I can manage. I didnt have this error at first and now I do get it with every pc i try and also with packages after a basic expo init.

Hey @xuthal, thanks for the reply, I’ve never actually published a expo project. When you say publish, you mean that you can run expo publish to run on an emulator? I usually just run expo start to run the emulator

Oh @xuthal, I got it working by running expo publish, deleting the project on expo.io and then running expo start. Not sure why this happened tho…