Distillery release failing to boot with `cannot expand $ERTS_LIB_DIR in bootfile`

My environment:

Distillery 1.5.3
Elixir 1.6.6
Erlang 21.0

When I set include_erts: false and I try running a release, I get this error:

init terminating in do_boot (cannot expand $ERTS_LIB_DIR in bootfile)

Crash dump is being written to: erl_crash.dump...done

I’ve tracked it down to being something to do with _build/dev/rel/my_app/bin/start_clean.boot… when booting, calls like erl -eval 'io:format("~s~n", [code:root_dir()]), halt().' -noshell -boot start_clean will fail with the above error if smart_clean.boot exists and they will succeed if it doesn’t. (booting fails further down the line if it doesn’t exist with init terminating in do_boot ({cannot get bootfile,start_clean.boot})).

The only issue I can see that’s somewhat related is not very helpful: https://github.com/bitwalker/distillery/issues/235

Any insights?

I haven’t personally encountered this, however did you try setting the ERTS_LIB_DIR environment
variable ?

Ok, it seems like my issue must be from some weird stuff in my _build dir, possibly related to upgrading to a new Erlang version without wiping it out. After deleting it and rebuilding, it appears to work!