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