3

When running my ember application with ember serve -e local I get:

Port 4200 is already in use.

Which is weird because no application is running on 4200. I tried to open a dummy HTTP server on 4200 with http-server and it works just fine. It also works when I specify the port via a command line flag ember serve --port 4200.

Some things I've tried:

  • Restarted my computer.
  • Removed the node_modules.
  • Remove the ember tmp directory.
  • Disabled my firewall.
  • Tried with disabled wi-fi.

Any thoughts?


I'm running on masOS High Sierra 10.13.6 with the following versions:

  • node: 8.11.3
  • ember-cli: 2.18.2
  • npm: 5.6.0 (also tried with 6.3.0)

Also useful to know:

  • I have other ember applications running on my computer just fine.
  • I started to have this problem only recently.
  • In the past, macOS would keep asking me about authorizing incoming traffic whenever an app was opened, but now it stopped asking me.
sandstrom
  • 14,554
  • 7
  • 65
  • 62
geauser
  • 1,005
  • 8
  • 20

2 Answers2

1

After further investigation, it seems that the problem is not coming from macOS, but from something messed up in the dependencies causing ember-cli to fail...

It's not quite clear what is causing this, and I will try to post any additional information here, but for now if you happen to encounter this problem, just pass the port value directly to ember-cli like so:

ember serve --port 4200

geauser
  • 1,005
  • 8
  • 20
  • We are also getting this error consistently, and adding `--port 4200` works. Did you ever figure out what's causing this? – dwenzel Aug 16 '18 at 14:59
  • @dwenzel I don't know for sure... When I think about it, the problem happened to me when I reinstalled my `node_modules`. I was the only one to have this problem until my co-workers also updated their `node_modules` _(they had a different node and NPM version)_ so I guess the problem is coming from an Ember package. – geauser Aug 19 '18 at 16:53
  • @LittleStrongMind Did you happen to find a more permanent solution for this? I'm having the same issue after reinstalling node_modules. – Brian K. Aug 17 '19 at 21:52
1

I had this issue and tracked it down to using a string vs. integer for port in .ember-cli.

// .ember-cli
{
  "port": 8080, // works
  "port": "8080", // throws the error mentioned above
}

Not sure if this is the cause for others with this error. As mentioned, first thing is to make sure nothing else is actually running on that port. But OP had already checked that, and so had I.

sandstrom
  • 14,554
  • 7
  • 65
  • 62