You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pkgxdev/dev@v1: Elixir not working without manual ERL_ROOTDIR adjustment #56
I ran into problems using pkgxdev/dev@v1 with Elixir. The workflow fails unless I add the following workaround, which sets ERL_ROOTDIR explicitly. With this in place, Elixir runs fine:
.github/actions/elixir-setup/action.yml
name: Elixir setup
description: Setup Elixir for a given path
runs:
using: composite
steps:
- uses: pkgxdev/dev@v1
- shell: bash
run: |
unset ERL_ROOTDIR
ERL_BIN="$(command -v erl)"
ERL_BIN_REAL="$(readlink -f "$ERL_BIN")"
ERL_DIR="$(dirname "$(dirname "$ERL_BIN_REAL")")"
if [ -d "$ERL_DIR/lib/erlang" ]; then
ERL_BASE="$ERL_DIR/lib/erlang"
else
ERL_BASE="$ERL_DIR"
fi
echo "ERL_BASE=$ERL_BASE" >> "$GITHUB_ENV"
echo "ERL_ROOTDIR=$ERL_BASE" >> "$GITHUB_ENV"
.github/workflows/ci.yml
name: ci
on:
push:
branches: main
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/elixir-setup
- run: elixir -e "IO.puts(1 + 2)"
Is this something that should be fixed in pkgxdev/dev@v1 itself, or is it expected that workflows need to add this step? Or does this point to something about the packages themselves?
/home/runner/.pkgx/erlang.org/v26.1.1/bin/erl: 57: exec: ${ERL_ROOTDIR:-/home/runner/.pkgx/erlang.org/v26.1.1/lib/erlang}/erts-14.1/bin/erlexec: not found
The consistent pattern seems to be: ERL_ROOTDIR must be explicitly set (is it the ${ERL_ROOTDIR:-...} defaulting that doesn’t resolve properly in CI?).
Do you think this is something pkgx or pkgxdev/dev should handle?
Sorry, coming back. That suggests that something else in your CI might be setting ERL_ROOTDIR, so the conditional set isn't working. It should be supported in even quite old versions of bash, and that's ubunutu 24.
Can you re-run those last two, and add a env | grep ERL_, to see how they're resolving in practice?
Thanks for looking further into this @jhheider. To be sure there's no over-complications I've applied your suggestion to this simple workflow that avoids the action-pattern in favor of simple steps:
It fails with the same error raised in this thread:
Run elixir -e "IO.puts(1 + 2)"
/home/runner/.pkgx/erlang.org/v26.1.1/bin/erl: 57: exec: ${ERL_ROOTDIR:-/home/runner/.pkgx/erlang.org/v26.1.1/lib/erlang}/erts-14.1/bin/erlexec: not found
The env | grep step outputs:
Run env | grep ERL_
ERL_ROOTDIR=${ERL_ROOTDIR:-/home/runner/.pkgx/erlang.org/v26.1.1/lib/erlang}
This avoids confusing matters with my attempts at actions and conditional logic, focusing on the core issue of pkgxdev/dev@v1 appearing to not be a able to run Elixir like how it works from my terminal.
that's being fed here: fs.appendFileSync(process.env["GITHUB_ENV"], ${key}=${v}\n);. so, it looks like the shell isn't getting an opportunity to deal with it. i think i have a fix.
Activity
jhheider commentedon Aug 26, 2025
so. this works fine in a shell with dev:
so, what is
ERL_ROOTDIRset to in your CI (both in the inner action, and in the job) if you don't modify it? it should be being set byerlang.orgto:it's possible there's some issue with the env propagating up from the lower action.
this:
dev/action.js
Lines 41 to 44 in 0e5d6c3
cat $GITHUB_ENV(though, be careful if there's secret data) could also be illustrative.gaggle commentedon Aug 30, 2025
@jhheider good points. I've created a sample repo to illustrate the issue.
This simple pkgxdev/dev-based workflow fails:
Error:
(via this run)
Inspecting its env shows:
By contrast, a workflow that explicitly sets ERL_ROOTDIR works fine (this run, via this action):
I tested variations:
The consistent pattern seems to be:
ERL_ROOTDIRmust be explicitly set (is it the${ERL_ROOTDIR:-...}defaulting that doesn’t resolve properly in CI?).Do you think this is something
pkgxorpkgxdev/devshould handle?gaggle commentedon Sep 29, 2025
Gentlest possible /poke @jhheider
jhheider commentedon Sep 29, 2025
Sorry, coming back. That suggests that something else in your CI might be setting ERL_ROOTDIR, so the conditional set isn't working. It should be supported in even quite old versions of bash, and that's ubunutu 24.
Can you re-run those last two, and add a
env | grep ERL_, to see how they're resolving in practice?gaggle commentedon Sep 29, 2025
Thanks for looking further into this @jhheider. To be sure there's no over-complications I've applied your suggestion to this simple workflow that avoids the action-pattern in favor of simple steps:
It fails with the same error raised in this thread:
The
env | grepstep outputs:(via this run)
This avoids confusing matters with my attempts at actions and conditional logic, focusing on the core issue of
pkgxdev/dev@v1appearing to not be a able to run Elixir like how it works from my terminal.jhheider commentedon Sep 29, 2025
It looks like an escaping issue. The value in the env is uninterpreted. So, that's probably a dev issue. I'll take a look.
gaggle commentedon Nov 24, 2025
Gentle ping, wonder if I can help bring more light or solutions to this?
jhheider commentedon Nov 24, 2025
so, the problem is that it's never evalling when writing to GITHUB_ENV:
https://github.com/pkgxdev/dev/blob/main/action.js
that's being fed here:
fs.appendFileSync(process.env["GITHUB_ENV"],${key}=${v}\n);. so, it looks like the shell isn't getting an opportunity to deal with it. i think i have a fix.fix ERL_ROOTDIR issues
jhheider commentedon Nov 24, 2025
can you test changing your reference to:
- uses: pkgxdev/dev@fix-erlang, and see if that helps?Try GHA `pkgxdev/dev@fix-erlang`
CI pkgx fixes
CI pkgx fixes
CI pkgx fixes
CI pkgx fixes
CI pkgx fixes
CI pkgx fixes
CI pkgx fixes
Update simple.yml
gaggle commentedon Nov 26, 2025
I did that commit, and the run turned green 🥳. Thank you.
For the sake of completes I did then subsequently catch a single sporadic failure:
But I haven't seen it reappear, so hopefully not worth more time spent on that.