灰烬服务:每个端口都在使用中 [英] Ember serve: every port is in use

查看:49
本文介绍了灰烬服务:每个端口都在使用中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我没有指定端口或明确设置端口时,总是看到:

When I specify no port or set the port explicitly, I always see:

ember serve --port 4207
Port 4207 is already in use.

我选择哪个端口似乎并不重要。

It doesn't seem to matter which port I pick.

当我从端口0开始(让cli选择一个可用的端口)时,它开始于30000〜40000左右。

When I start with port 0 (let the cli pick an available port) it starts on on something around 30000~40000.

我位于一个苹果电脑。我刚刚将ember-cli升级到 3.12.0

I am on a Mac. I just upgraded my ember-cli to 3.12.0

另外:如果我启动另一个ember应用程序,我在本地,它将在端口4200上运行。但是然后我停止它并启动上面的应用程序,它将无法在该端口上启动。

Also: If I start another ember app I have locally, it will run on port 4200. But then I stop it and start the above app and it won't start on that port.

这是怎么回事?

推荐答案

portfinder 是Ember CLI的一个从属,发布了一些新版本 1.0.22 小时前(2019年8月17日)。那个琥珀色发球。您会看到所有端口的端口使用错误。

portfinder, which is a subdependency of Ember CLI, released a new version 1.0.22 a few hours ago (August 17, 2019). That one breaks ember serve. You will see a port in use error for all ports.

如果不确定使用哪个版本的 portfinder 在您的项目中,您可以运行了解为什么选择portfinder npm list | grep portfinder

If you are unsure which version of portfinder is used in your project, you could run yarn why portfinder or npm list | grep portfinder.

更新 portfinder@1.0.23 已于今天(2019年8月19日)发布。它回滚到 1.0.21 并因此解决了该问题。您应该升级到该新版本。

Update: portfinder@1.0.23 was released today (August, 19 2019). It rolls back to 1.0.21 and therefore fixes the issue. You should upgrade to that new release.

以下版本的回合已被新版本的 portfinder

The following work-a-rounds are outdated by new release of portfinder.

到目前为止,有两个工作回合:

There are two work-a-round known so far:

1。将 portfinder 降级为 1.0.21

1. Downgrading portfinder to 1.0.21.

您可以使用纱线的分辨率功能来实现。将此添加到您的 package.json

You could use yarn's resolutions feature to do so. Add this to your package.json:

"resolutions": {
  "ember-cli/portfinder": "1.0.21"
}

不要忘了之后运行 yarn install

如果使用npm,则可以强制安装之前发布的依赖项今天使用 -before 选项 npm install-在2019-08-16之前

If using npm, you could enforce installing dependencies released before today using the --before option: npm install --before 2019-08-16

2。使用 ember服务--port 0

2. Using ember serve --port 0

您可以开始 ember服务-port 0 参数。在这种情况下,portfinder会选择一个随机端口。这似乎有效。使用的端口在终端中报告,例如

You could start ember serve with --port 0 argument. In that case portfinder picks up a random port. This seems to work. The port used is reported in terminal, e.g.


构建成功(1911ms)–在 http:// localhost:18780 /

已报告错误< a href = https://github.com/ember-cli/ember-cli/issues/8794 rel = nofollow noreferrer>此处。希望它将很快解决。

The bug is reported here. Hopefully it will be resolved soon.

这篇关于灰烬服务:每个端口都在使用中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆