I’m going through the recent Nitrogen book and walking someone through the setup to teach them erlang with a brand new install and they are getting an interesting error when running make ... from a fresh git clone https://github.com/nitrogen/nitrogen.git:
❯ make slim_cowboy PROJECT=testnitro
make[1]: Entering directory '/home/<usr>/erlang/nitrogen'
./rebar get-deps
escript: exception error: undefined function rebar:main/1
in function escript:run/2 (escript.erl, line 750)
in call from escript:start/1 (escript.erl, line 277)
in call from init:start_em/1
in call from init:do_boot/3
make[1]: *** [Makefile:40: get-deps] Error 127
make[1]: Leaving directory '/home/<user>/erlang/nitrogen'
make: *** [Makefile:83: slim_cowboy] Error 2
And having them run ./rebar returns the same issue:
❯ ./rebar
escript: exception error: undefined function rebar:main/1
in function escript:run/2 (escript.erl, line 750)
in call from escript:start/1 (escript.erl, line 277)
in call from init:start_em/1
in call from init:do_boot/3
I’m pretty sure I know their issue, but I’m curious if a better and more accurate error message could be provided to such a newbie to erlang?
For note, they grabbed the old rebar 2.6.4 and replaced the one in the nitrogen clone with it then it worked (thus we continued), but that seems wrong to do?
In addition, we had a later issue but we just added the base erlang to the path instead of a shim (via asdf env erl), but this also seems very wrong and unnecessary as any other erlang thing that I do and have ran works fine with asdf?
The latter issue seems odd as the bin/nitrogen script doesn’t seem to look even remotely close to any of my modern runner scripts generated by rebar3 or mix release or anything of the sort (all of which work fine), so I’m curious how this one is intended to work?
Yeah, working around it with just sourcing the variables returned from asdf env erl fixes it, but it seems excessively odd that that is necessary as I run quite a hoard of BEAM things without issue otherwise?
Yeah. I’m sure it’s just a relic of rebar2 and Nitrogen’s default pretty-custom directory structure (hence why it’s taking so long to get nitrogen converted to rebar3).
Hello @OvermindDL1
I’m relatively a newbie, and I’ve just switched to using asdf to manage my Erlang versions. Every other thing is running fine like before, except that I’m getting this same error in Nitrogen.
Could you please elaborate on how to source those numerous variables returned by the asdf env erl command? Thanks.
I’ve tried source asdf env erl from the terminal and I now get this error:
/home/<user>/.asdf/bin/asdf:.:4: no such file or directory: ./lib/utils.bash
asdf_cmd:3: = not found
which I’m not sure of how to fix.
As of now I have to manually disable the asdf plugin from my ~/.zshrc file each time I switch to a project in nitrogen, which is not convenient.