Skip to content

M1 Macbook: Error: listen EADDRINUSE: address already in use :::9005 #4684

@thathurtabit

Description

@thathurtabit

[REQUIRED] Environment info

firebase-tools: 11.1.0

Platform: macOS 12.2.1

[REQUIRED] Test case

I've just bought a new Macbook Pro (M1 Pro Chip) and have cloned a repo that runs without issue on my previous (non-M1) Macbook Pro - I mention this as I've heard M1 Macs won't run some applications...

Anyway,

  • npm i -g firebase-tools - node version 16.14.2 | npm 8.5.0
  • $ firebase outputs expected Usage: firebase [options] [command]... options
  • $ firebase emulators:start --only functions

ui-debug.log outputs this (before crash):

Web / API server started at localhost:4000

Fails with:

i  emulators: Starting emulators: functions
⚠  functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: auth, firestore, database, hosting, pubsub, storage
✔  functions: Using node@16 from host.
i  ui: Emulator UI logging to ui-debug.log
i  functions: Watching "/Users/myname/Repos/my-firebase-app/functions/" for Cloud Functions...
node:events:504
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE: address already in use :::9005
    at Server.setupListenHandle [as _listen2] (node:net:1330:16)
    at listenInCluster (node:net:1378:12)
    at Server.listen (node:net:1465:7)
    at /Users/myname/Repos/my-firebase-app/functions/lib/index.js:75:47
    at new Promise (<anonymous>)
    at /Users/myname/Repos/my-firebase-app/functions/functions/lib/index.js:75:11
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Emitted 'error' event on Server instance at:
    at emitErrorNT (node:net:1357:8)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'EADDRINUSE',
  errno: -48,
  syscall: 'listen',
  address: '::',
  port: 9005
}
i  emulators: Shutting down emulators.
i  ui: Stopping Emulator UI
⚠  Emulator UI has exited upon receiving signal: SIGINT
i  functions: Stopping Functions Emulator
i  hub: Stopping emulator hub
i  logging: Stopping Logging Emulator

Attempt to track down in-use port (9005?)

lsof -i tcp:9005
kill $(lsof -ti:9005)
kill: not enough arguments

[REQUIRED] Steps to reproduce

Try to follow the above

[REQUIRED] Expected behavior

Firebase functions run...

[REQUIRED] Actual behavior

Firebase functions crash with above error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions