compiler-errorserlangbeam

Error when compiling Erlang modules in Windows


I'm a beginner at programming Erlang and at Stack Overflow, so I hope this isn't a very silly question.

I've installed Erlang/OTP 20.1 from the official website, on Windows 10. I'm trying to compile some simple Erlang modules from erl, werl or git bash (from the correct directory), and I get the following error:

3> c(useless).
useless.erl: internal error in beam_asm;
crash reason: undef

in function  maps:size/1
 called as maps:size(#{})
in call from beam_dict:atom/2 (beam_dict.erl, line 88)
in call from beam_asm:assemble/5 (beam_asm.erl, line 65)
in call from beam_asm:module/5 (beam_asm.erl, line 62)
in call from compile:beam_asm/2 (compile.erl, line 1454)
in call from compile:'-internal_comp/5-anonymous-1-'/3 (compile.erl, line 342)
in call from compile:fold_comp/4 (compile.erl, line 369)
in call from compile:internal_comp/5 (compile.erl, line 353)

What do you think is the problem? Exactly the same error appears with each module, no matter where it is saved. The funny thing is that I could compile and run these modules yesterday without a problem, but I got the same problem before yesterday!

Thanks a lot!

Bernat


Solution

  • Did you create a module called "maps"? In that case, the problem is that you have overridden the standard maps module (which contains the size/1 function) with one that has no such function, hence the "undef".