当使用 ember serve -e local
运行我的 ember 应用程序时,我得到:
Port 4200 is already in use.
这很奇怪,因为没有应用程序在 4200 上运行。我试图用 http-server 在 4200 上打开一个虚拟 HTTP 服务器。它工作得很好。当我通过命令行标志 ember serve --port 4200
指定端口时,它也有效。
我尝试过的一些事情:
- 重新启动我的电脑。
- 删除了
node_modules
。 - 删除 ember
tmp
目录。 - 禁用了我的防火墙。
- 尝试使用禁用的 Wi-Fi。
有什么想法吗?
我在 masOS High Sierra 10.13.6 上运行以下版本:
- Node :8.11.3
- ember-cli: 2.18.2
- npm: 5.6.0 (也试过 6.3.0)
知道也很有用:
- 我的计算机上运行着其他 ember 应用程序,一切正常。
- 我最近才开始遇到这个问题。
- 过去,macOS 会在打开应用程序时不断询问我是否授权传入流量,但现在它不再询问我了。
最佳答案
我遇到了这个问题,并追踪到在 .ember-cli
中对 port
使用字符串与整数。
// .ember-cli
{
"port": 8080, // works
"port": "8080", // throws the error mentioned above
}
不确定这是否是其他人出现此错误的原因。如前所述,首先要确保该端口上实际上没有其他任何东西在运行。但是 OP 已经检查过了,我也是。
关于node.js - Ember Server : "Port 4200 is already in use", 当没有进程在 4200 上运行时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51755399/