Search code examples
elixirelixir-mix

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


I built an Elixir app using mix release and when I run it using .\_build\prod\rel\prod\bin\prod start, I get the following error:

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}

I looked into fsutil and changing my computer name (Windows 10) but no help.

I also tried what @aleksei mentioned but no luck:

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

My mix.exs has the following:

  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

The env.bat.eex has the following:

@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

Solution

  • The default template for env.bat.eex is configured to work with releases across nodes and depends on the @release.name module variable to be set.

    To run the release with short node name, simply comment everything inside 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