运行 Windows 上的 Elixir 应用程序:无法设置短节点名称

Running Elixir app on Windows: Can't set short node name

我使用 mix release 构建了一个 Elixir 应用程序,当我使用 .\_build\prod\rel\prod\bin\prod start 运行 它时,我收到以下错误:

2020-02-08 19:57:52.981000
    args: []
    format: "Can't set short node name!\nPlease check your configuration\n"
    label: {error_logger,info_msg}

我查看了 fsutil 并更改了我的计算机名称 (Windows 10),但没有帮助。

我也尝试了@aleksei 提到的方法,但没有成功:

.\_build\prod\rel\prod\bin\prod start --sname zpc

我的 mix.exs 有以下内容:

  def project do
    [
      app: :km,
      releases: [
        prod: [
          include_executables_for: [:unix, :windows],
          steps: [:assemble, :tar]
        ]
      ],
      version: "0.1.0",
      elixir: "~> 1.9",
      start_permanent: Mix.env() == :prod,
      deps: deps()
    ]
  end

env.bat.eex有以下内容:

@echo off
rem Set the release to work across nodes. If using the long name format like
rem the one below (my_app@127.0.0.1), you need to also uncomment the
rem RELEASE_DISTRIBUTION variable below.
rem set RELEASE_DISTRIBUTION=km
set RELEASE_NODE=<%= @release.name %>@127.0.0.1

env.bat.eex 的默认模板配置为跨节点发布,并取决于要设置的 @release.name 模块变量。

对于运行短节点名称的版本,只需注释env.bat.eex中的所有内容:

@echo off
rem Set the release to work across nodes.
rem If using the long name format like
rem   the one below (my_app@127.0.0.1),
rem   you need to also uncomment the
rem   RELEASE_DISTRIBUTION variable below.
rem
rem set RELEASE_DISTRIBUTION=km
rem set RELEASE_NODE=<%= @release.name %>@127.0.0.1