Mix Release - 'erlexec' not detected, when starting /any/ app, despite running fine in iex

I’m quite new to Elixir (and programming in general), so apologies if the fault turns out to be a simple one, and one of my doing:

tl:dr; When starting any app built with Mix Release, I keep getting the following error - despite the apps running fine via iex.bat -S mix, and reporting no errors in the Mix Release build process:

(I’m using Windows 10 64-bit, Erlang/OTP 21, Elixir 1.11.2)

/c/Users/../Documents/../../Mix Release/mix_release_1_phxapp_1/_build/prod/rel/ * app name */releases/0.1.0/../../erts-10.3/bin/erl:    line 12: /c/Users/../../Documents/../../Mix Release/mix_release_1_phxapp_1/_build/prod/rel/ * app name * /erts-10.3/bin/erlexec:   No such file or directory


**Explanation: **

I recently tried to create my first, simple, deployed app - I’ve not gone near this part of the production process before, so I followed this simple and friendly tutorial on how to do so (with the intention of eventually hosting it on Render.com).

However, this tutorial is for a standalone Phoenix app, and mine is an umbrella project with a database interface/repo/etc as the other child-app. I had to thus piece together how to adapt the tutorial for an umbrella app (primarily through ‘appropriately’ changing the ./build.sh script) - being very much a rookie, I ofc thought I might have caused the problem, in this process:

After tweaking the ‘./build.sh’ enough, I eventually got the app to build via Mix Release with no errors. And indeed, running it via iex.bat -S mix is errorless, too. However, when trying to locally start the Mix Released app after building it, I get a cryptic error, that I can hardly find any information for:

NOTE: I have cut out some of the long, superfluous bits of the file paths.

$ SECRET_KEY_BASE=`mix phx.gen.secret` _build/prod/rel/mix_release_1_phxapp_1/bin/mix_release_1_phxapp_1 start

/c/Users/../../Mix Release/mix_release_1_phxapp_1/_build/prod/rel/mix_release_1_phxapp_1/releases/0.1.0/../../erts-10.3/bin/erl: line 12: /c/Users/../../Mix Release/mix_release_1_phxapp_1/_build/prod/rel/mix_release_1_phxapp_1/erts-10.3/bin/erlexec: No such file or directory

My ./build.sh script, that I execute in Windows with GIT Bash:


echo "Building App"
#!/usr/bin/env bash
# exit on error
set -o errexit

# Initial setup
mix deps.get --only prod
MIX_ENV=prod mix compile

# Compile assets
cd ./apps/phxapp/assets && npm install
npm run deploy
cd ..
mix phx.digest
cd ../../
# Build the release and overwrite the existing release directory
MIX_ENV=prod mix release --overwrite

Again, I of course thought the error could come from trying to adapt the above tutorial to an umbrella app, but, I then tried the tutorial line-by-line with just a generic, standalone Phoenix app, created with mix phx.new etc.

Still the same error. Which tells me there’s something bigger I need to fix than a coding error of my own.

I have looked everywhere for info on erlexec, and how to solve this error, but haven’t found much (especially in terms of stuff that’s understandable to a novice like me) - all I’ve seen is that, apparently, erlexec is the code to actually generate the Erlang VM, on systems that don’t contain Erlang, so the Elixir app can run?

Secondly, apparently Windows 10 (which I’m using), and older, sometimes don’t include erlexec, unless you explicitly tell it to? I tried doing this, via adding set include_erts: true into config.exs, but to no avail. Though, I don’t know of course if any of that is right.


Apologies for the lengthy post - everything I’ve tried/tried to look up has hit a dead-end, so any help would be really appreciated!

Thanks so much

1 Like

Welcome to the Forum and to Elixir :tada:

To help us debug can you show us the contents of your mix.exs file?

1 Like

Sure! And thanks so much for the warm welcome.

The umbrella project’s mix.exs:

defmodule TewChat2.MixProject do
  use Mix.Project

  def project do
    [
      apps_path: "apps",
      version: "0.1.0",
      start_permanent: Mix.env() == :prod,
      deps: deps(),
      version: "0.1.0",
      elixir: "~> 1.9",
      releases: [
        tew_chat_2: [
          applications: [
            db: :permanent,
            phxapp: :permanent
          ]
        ]
      ]
    ]
  end
  #Hey
  # Dependencies listed here are available only for this
  # project and cannot be accessed from applications inside
  # the apps folder.
  #
  # Run "mix help deps" for examples and options.
  defp deps do
    []
  end
end

The Phoenix Child-App’s mix.exs:

defmodule Phxapp.MixProject do
  use Mix.Project

  def project do
    [
      app: :phxapp,
      version: "0.1.0",
      build_path: "../../_build",
      config_path: "../../config/config.exs",
      deps_path: "../../deps",
      lockfile: "../../mix.lock",
      elixir: "~> 1.7",
      elixirc_paths: elixirc_paths(Mix.env()),
      compilers: [:phoenix, :gettext] ++ Mix.compilers(),
      start_permanent: Mix.env() == :prod,
      aliases: aliases(),
      deps: deps()
    ]
  end

  # Configuration for the OTP application.
  #
  # Type `mix help compile.app` for more information.
  def application do
    [
      mod: {Phxapp.Application, []},
      extra_applications: [:logger, :runtime_tools]
    ]
  end

  # Specifies which paths to compile per environment.
  defp elixirc_paths(:test), do: ["lib", "test/support"]
  defp elixirc_paths(_), do: ["lib"]

  # Specifies your project dependencies.
  #
  # Type `mix help deps` for examples and options.
  defp deps do
    [
      {:phoenix, "~> 1.5.5"},
      {:phoenix_live_view, "~> 0.14.6"},
      {:floki, ">= 0.27.0", only: :test},
      {:phoenix_html, "~> 2.11"},
      {:phoenix_live_reload, "~> 1.2", only: :dev},
      {:phoenix_live_dashboard, "~> 0.2"},
      {:telemetry_metrics, "~> 0.4"},
      {:telemetry_poller, "~> 0.4"},
      {:gettext, "~> 0.11"},
      {:jason, "~> 1.0"},
      {:plug_cowboy, "~> 2.0"},
      {:db, in_umbrella: true},
      {:phoenix_ecto, "~> 4.2.1"},
      {:enum_type, "~> 1.1.0"}
    ]
  end

  # Aliases are shortcuts or tasks specific to the current project.
  #
  # See the documentation for `Mix` for more info on aliases.
  defp aliases do
    [
      setup: ["deps.get", "cmd npm install --prefix assets"]
    ]
  end
end

The Database Child-App’s mix.exs:


defmodule Db.MixProject do

  use Mix.Project

  def project do

    [

      app: :db,

      version: "0.1.0",

      build_path: "../../_build",

      config_path: "../../config/config.exs",

      deps_path: "../../deps",

      lockfile: "../../mix.lock",

      elixir: "~> 1.10",

      start_permanent: Mix.env() == :prod,

      deps: deps()

    ]

  end

  # Run "mix help compile.app" to learn about applications.

  def application do

    [

      extra_applications: [:logger],

      mod: {Db.Application, []}

    ]

  end

  # Run "mix help deps" to learn about dependencies.

  defp deps do

    [

      # {:dep_from_hexpm, "~> 0.3.0"},

      # {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"},

      # {:sibling_app_in_umbrella, in_umbrella: true}

      {:postgrex,"~> 0.15.7"},

      {:ecto_sql, "~> 3.5.3"},

      {:comeonin, "~> 5.3.1"},

      {:pbkdf2_elixir, "~> 1.2.1"},

    ]

  end

end

Thanks so much! Really appreciate it.

Those, of course, are for the umbrella app - do you want the mix.exs of the barebones, standalone Phoenix app I mentioned in the post, too?

Thanks.

I don’t think that’s necessary, and everything in the mix.exs files looks okay to me. How did you install elixir and erlang? I’m not very well versed in windows development, but it seems a little odd to be running iex.bat for your testing, but then using Git Bash as well. Are those using two different elixir installations?

Ok, thanks so much - there’s been a major update

I got it to work!.. And now it’s not working again :expressionless:

Explanation:

  • Firstly, I stumbled upon this helpful tutorial, and completed the first 4 steps, before I had the ideas for what’s written below, and switched to that. Unfortunately, I didn’t try the build process again yet, after having gone that far through the tut - only after I’d done both those 4 steps and what’s written below. So I can’t be sure which branch of steps ‘solved’ my original problem, and indeed, what’s gone on to cause the new errors. But I think what’s written below is where the progress came from.

Ok, so basically, the reason I was using Git Bash to run the script is because I’m very unfamiliar with both Git Bash and writing scripts for the Windows PowerShell - the original tutorial called for and demo’d the bash version, and I struggled to get the Windows .ps1 version to work, so I just used theirs, with bash. However, after you mentioned it, I went back to trying to figure out an equivalent .ps1 script - and got it to work!

Turns out that seemed to get things moving! Upon using the now-correct (it seems) .ps1 script, I started receiving new error-info, now (instead of the bash console) in the Windows PowerShell:

  1. Some stuff about node-sass not being correct (I had an intuition, however, that this wouldn’t affect the overall build/compilation success, just whether things would perform in the browser correctly, should I get to that stage? So I left it, for now. More on this, later…)

  2. It told me that: the supplied ‘releases’ (if I remember right), of ‘:tew_chat_2’ wasn’t one of the ones registered/suported, of: [:prod, :test, …] - I had a flash of intuition thus to change, in the top lvl mix.exs file, ‘:tew_chat_2’ in the releases kw list to ‘:prod’ - that did it! After changing this, it worked! It built, and seemed to run like a dream - starting it didn’t generate the original error of ‘no erlexec’, and the app itself worked great.

  3. I also noticed that the file path quoted as the output of the Mix Release build (_build/prod/rel/prod/bin/prod start) was different than the one output by running it all with Git Bash - thus, maybe it couldn’t find ‘erlexec’ because Git Bash expected the build to have a different path than Windows provided, and it was looking in the wrong place? Unsure on this of course, but thought it was noteworthy.

------ So, building & running the app succeeded - now I’ve run into more problems -----------

  1. I went back into my IDE to improve the app, running it now ofc with iex.bat -S mix phx.server, only now my hot-reloading - and seemingly even overall responding to some css changes after a forced, full-page-reload - was gone. I think everything else in the app was running fine (it looked fine in the browser). But not this. I could be wrong however, and maybe there was more that wasn’t working right (see below) already at this stage - note everything did seem to fully work, when using that first Mix Released app. Only now back in iex.bat, and on subsequent Mix Release builds, is is going wrong??

  2. I thought this might be due to those aforementioned node-sass errors, and that this would be a good time to try and fix them… in the latter at least, I was wrong :expressionless: I tried my hand at guides like this, this, and this, but nothing - in fact, I was getting different errors throughout.

Further Details

Now, the app still compiles with iex.bat -S mix and Mix Release - but it’s lost all its LiveView reactivity??

Everything at first looks right on screen, but e.g. none of the divs with phx-click events do anything when clicked, and nothing registers from them on the console (output info should be coming through, as well as on-screen changes). Conversely, the ‘regular’ Phoenix portions, including links etc, interaction with the database, seem to be working fine.

When I run the app from the terminal, I get this error (with other info populated around):


ERROR in ./css/app.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
Error: Cannot find module 'node-sass'


After re-setting my package.json to the original node-sass settings, I again tried this to reset node-sass - but trying to install it via npm install node-sass@4.14.1 gives me this error??:


Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/win32-x64-88_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.14.1/win32-x64-88_binding.node": 

HTTP error 404 Not Found

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g.

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080

> node-sass@4.14.1 postinstall C:\Users\David\Documents\Computer Projects\Elixir\Projects\tew_chat_2\apps\phxapp\assets\node_modules\node-sass
> node scripts/build.js

Building: C:\Program Files\nodejs\node.exe C:\Users\David\Documents\Computer Projects\Elixir\Projects\tew_chat_2\apps\phxapp\assets\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'C:\\Users\\David\\Documents\\Computer Projects\\Elixir\\Projects\\tew_chat_2\\apps\\phxapp\\assets\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@3.8.0
gyp info using node@15.5.0 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\David\Documents\Computer Projects\Elixir\Projects\tew_chat_2\apps\phxapp\assets\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\David\Documents\Computer Projects\Elixir\Projects\tew_chat_2\apps\phxapp\assets\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\David\Documents\Computer Projects\Elixir\Projects\tew_chat_2\apps\phxapp\assets\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\David\Documents\Computer Projects\Elixir\Projects\tew_chat_2\apps\phxapp\assets\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\David\Documents\Computer Projects\Elixir\Projects\tew_chat_2\apps\phxapp\assets\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\David\Documents\Computer Projects\Elixir\Projects\tew_chat_2\apps\phxapp\assets\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:199:21)
gyp verb `which` failed  python2 Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\David\Documents\Computer Projects\Elixir\Projects\tew_chat_2\apps\phxapp\assets\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\David\Documents\Computer Projects\Elixir\Projects\tew_chat_2\apps\phxapp\assets\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\David\Documents\Computer Projects\Elixir\Projects\tew_chat_2\apps\phxapp\assets\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\David\Documents\Computer Projects\Elixir\Projects\tew_chat_2\apps\phxapp\assets\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\David\Documents\Computer Projects\Elixir\Projects\tew_chat_2\apps\phxapp\assets\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\David\Documents\Computer Projects\Elixir\Projects\tew_chat_2\apps\phxapp\assets\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:199:21) {
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:\Python39\python.EXE
gyp ERR! configure error 
gyp ERR! stack Error: Command failed: C:\Python39\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (node:child_process:333:12)
gyp ERR! stack     at ChildProcess.emit (node:events:376:20)
gyp ERR! stack     at maybeClose (node:internal/child_process:1063:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:295:5)
gyp ERR! System Windows_NT 10.0.19041
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\David\\Documents\\Computer Projects\\Elixir\\Projects\\tew_chat_2\\apps\\phxapp\\assets\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" 
"--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\David\Documents\Computer Projects\Elixir\Projects\tew_chat_2\apps\phxapp\assets\node_modules\node-sass
gyp ERR! node -v v15.5.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.14.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.14.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\David\AppData\Roaming\npm-cache\_logs\2021-01-04T10_42_11_472Z-debug.log

Going into phxapp/assets and running regular npm install doesn’t throw that error… but doesn’t solve the overall node-sass problem of the ‘module build failing’, either.


Apologies for how crazy and long this is all getting - anything anyone could do to help would be really, really appreciated, as I really need to finish this. Getting it back to ‘working’ would be so great.

Thanks so much!

Really appreciate it

Your nodejs is too new, 15? for node-sass@4.14.1. It is not a supported combo for node-sass. You can either downgrade nodejs to 14 or lower or upgrade node-sass to 5.0

1 Like

Thanks for the suggestion! Indeed that may have been the case; however, I’ve managed to get it to work now! I no longer receive the node-sass error, and the app retained its LiveViiew reactivity.

I re-attempted a solution in one of my above-mentioned threads, but this time successfully. I documented in that thread how I did it, and I’ll paste it here, too:


What happened was that I’d tried the earlier hints in this thread to replace "node-sass" with "sass", in the package.json . In doing that, I simply pasted over the "node-sass": "xx.xx.xx" line with "sass": "^1.22.10" - however, the "node-sass": "xx.xx.xx" line was (originally) written immediately after the line for sass-loader. So now, "sass": "^1.22.10" comes after it - this seemed to be the problem.

When I experimented with putting the new "sass": "^1.22.10" before sass-loader, saved and npm installed, it seemed to work.

Does that seem to make sense (if not, maybe I’ve remembered wrongly about what I did to fix it)?


Thanks so much! Hope the info helps anyone to follow.