elixir-lang / elixir

Elixir is a dynamic, functional language for building scalable and maintainable applications
https://elixir-lang.org/
Apache License 2.0
24.38k stars 3.36k forks source link

Unable to install - uncaught error in rebar_core #1108

Closed glanotte closed 11 years ago

glanotte commented 11 years ago

I am attempting to install on osx mountain lion. I first attempted through homebrew but received an error. I did then attempted to build from source.

When I run rake test I receive the following output

Uncaught error in rebar_core: {'EXIT',
                           {badarg,
                            [{re,replace,
                              [[36,40,109,97,99,104,105,110,101,95,112,
                                114,101,102,105,120,41,36,40,103,105,116,
                                95,115,116,97,116,117,115,41,37,123,27,91,
                                48,59,37,40,63,46,51,50,46,51,49,41,109,
                                37,125,10013,37,123,27,91,48,109,37,125,
                                32],
                               [92,36,40,"PROMPT",40,92,115,124,36,41,124,
                                123,"PROMPT",125,41],
                               [[],"\\2"],
                               [global,{return,list}]],
                              [{file,"re.erl"},{line,336}]},
                             {rebar_port_compiler,merge_each_var,2,
                              [{file,"src/rebar_port_compiler.erl"},
                               {line,412}]},
                             {rebar_port_compiler,setup_env,2,
                              [{file,"src/rebar_port_compiler.erl"},
                               {line,183}]},
                             {rebar_core,'-setup_envs/2-fun-0-',2,
                              [{file,"src/rebar_core.erl"},{line,454}]},
                             {lists,foldl,3,
                              [{file,"lists.erl"},{line,1248}]},
                             {rebar_core,process_dir0,6,
                              [{file,"src/rebar_core.erl"},{line,216}]},
                             {rebar_core,process_dir,4,
                              [{file,"src/rebar_core.erl"},{line,130}]},
                             {rebar_core,process_commands,2,
                              [{file,"src/rebar_core.erl"},{line,83}]}]}}

My apologies if this is something simple, I could not find any information on how to troubleshoot this.

I did install erlang-r16 via homebrew prior to install.

SaitoWu commented 11 years ago

Same problem here.

› brew install elixir
==> Downloading https://github.com/elixir-lang/elixir/archive/v0.9.0.tar.gz
######################################################################## 100.0%
==> make
                                 {rebar_core,process_dir,4,
                                  [{file,"src/rebar_core.erl"},{line,130}]},
                                 {rebar_core,process_commands,2,
                                  [{file,"src/rebar_core.erl"},{line,83}]}]}}
make: *** [erlang] Error 1

READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting
josevalim commented 11 years ago

Hello!

I think this is a bug in rebar. It was fixed some time ago but it is weird that is seems to be back. It usually happens when the PROMPT or another shell variable contains a utf-8 character.

@gianotta could you please try the following:

"PROMPT=hello" brew install elixir

In case it works, please paste your prompt here, so we can give it a try too:

echo $PROMPT
glanotte commented 11 years ago

Wow, thank you so much, I cannot believe that worked. My prompt is heavily customized with a UTF-8 character.

$(machine_prefix)$(git_status)%{%(?.32.31)m%}✝%{%}

Thank you so much! I will let you close this or keep it open if you want to track it further.

josevalim commented 11 years ago

@gianotte I will leave it open. We have fixed this issue a long time ago, I am surprised it still happens. :S

josevalim commented 11 years ago

Ok, I can't reproduce the issue. I have updated rebar hoping that it will fix it. If you see it again, please let me know! :D @SaitoWu if it still doesn't work for you, let us know too!

tonini commented 11 years ago

Hey @josevalim

I tried to install elixir v0.9.1 and run into the same issue:

brew install elixir

==> Downloading https://github.com/elixir-lang/elixir/archive/v0.9.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/elixir-0.9.1.tar.gz
==> make
                                 {rebar_core,'-setup_envs/2-fun-0-',2,[]},
                                 {lists,foldl,3,
                                  [{file,"lists.erl"},{line,1248}]},
                                 {rebar_core,process_dir0,6,[]}]}}
make: *** [erlang] Error 1

And here my hell of a prompt => %{%}%{%}%{%}%1~%{%} %{%}$(prompt_wunjo_scm_branch)%{%}%{%}%{%}

I just thought I would be good to know that it still fail with this kind of a sick prompt. ;)

cheers

kassio commented 11 years ago

Problems here too:

elixir(master)
$ make
Uncaught error in rebar_core: {'EXIT',
                               {badarg,
                                [{re,split,
                                  [[82,80,83,49,61,37,40,63,46,46,37,123,27,
                                    91,51,56,59,53,59,49,54,48,109,37,125,37,
                                    63,32,8629,41,37,123,27,91,48,48,109,37,
                                    125],
                                   "=",
                                   [{return,list},{parts,2}]],
                                  [{file,"re.erl"},{line,154}]},
                                 {rebar_port_compiler,'-os_env/0-lc$^0/1-0-',
                                  1,[]},
                                 {rebar_port_compiler,'-os_env/0-lc$^0/1-0-',
                                  1,[]},
                                 {rebar_port_compiler,os_env,0,[]},
                                 {rebar_port_compiler,setup_env,2,[]},
                                 {rebar_core,'-setup_envs/2-fun-0-',2,[]},
                                 {lists,foldl,3,
                                  [{file,"lists.erl"},{line,1248}]},
                                 {rebar_core,process_dir0,6,[]}]}}
make: *** [erlang] Error 1
$ echo $PROMPT

%{%}%~$(git_prompt_info)
$FG[046]$%{%}
kassio commented 11 years ago
$ PROMPT=hello brew install elixir                                                                                                                                                                                                                                        127 ↵
==> Downloading https://github.com/elixir-lang/elixir/archive/v0.9.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/elixir-0.9.1.tar.gz
==> make
                                 {rebar_core,'-setup_envs/2-fun-0-',2,[]},
                                 {lists,foldl,3,
                                  [{file,"lists.erl"},{line,1248}]},
                                 {rebar_core,process_dir0,6,[]}]}}
make: *** [erlang] Error 1

READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting
kassio commented 11 years ago

I found the problem.. I had installed the erlang with sudo and tried to install elixir with my user. When I fixed erlang permissions I'd install elixir successfully. :smiley:

terlar commented 11 years ago

What specific permissions did you fix? I'm getting the same error and didn't install erlang with sudo. Just installed it through brew install erlang-r16.

EDIT: (This to be more specific)

bash-3.2$ erl
Erlang R16B (erts-5.10.1) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
bash-3.2$ brew install elixir --verbose
==> Downloading https://github.com/elixir-lang/elixir/archive/v0.9.3.tar.gz
Already downloaded: /Library/Caches/Homebrew/elixir-0.9.3.tar.gz
tar xf /Library/Caches/Homebrew/elixir-0.9.3.tar.gz
==> make
make
Uncaught error in rebar_core: {'EXIT',
                               {badarg,
                                [{re,split,
                                  [[102,105,115,104,95,112,114,111,109,112,
                                    116,95,103,105,116,95,115,116,97,116,117,
                                    115,95,99,111,112,105,101,100,61,8658],
                                   "=",
                                   [{return,list},{parts,2}]],
                                  [{file,"re.erl"},{line,154}]},
                                 {rebar_port_compiler,'-os_env/0-lc$^0/1-0-',
                                  1,[]},
                                 {rebar_port_compiler,'-os_env/0-lc$^0/1-0-',
                                  1,[]},
                                 {rebar_port_compiler,os_env,0,[]},
                                 {rebar_port_compiler,setup_env,2,[]},
                                 {rebar_core,'-setup_envs/2-fun-0-',2,[]},
                                 {lists,foldl,3,
                                  [{file,"lists.erl"},{line,1248}]},
                                 {rebar_core,process_dir0,6,[]}]}}
make: *** [erlang] Error 1
josevalim commented 11 years ago

@terlar Have you tried the prompt solution mentioned above?

"PROMPT=hello" brew install elixir
terlar commented 11 years ago

Which shell are you running? Do you mean: PROMPT=hello brew install elixir

I have tried that and it makes no difference. Also my bash is zero-configured, so no fancy prompt going on.

josevalim commented 11 years ago

Interesting. Because the failure that you see right now happens when rebar is trying to handle your environment variables. If you type export in your shell, can you see any "weird" environment variable with unicode characters in it?

terlar commented 11 years ago

Okay, with this information I solved it.

I'm running fish-shell but started bash to just do this operation, and it had exported some variables with unicode characters. This was easily identifiable running export and I just unset these variables and it all went fine.

Thank you!

kassio commented 11 years ago

@terlar sorry, I don't know why but when I wrote that it was working. However when I read your message I tryed again and doen't work.With @josevalim solution works here too.

lazyatom commented 11 years ago

I also saw this issue with Elixir 0.9.3; my prompt does contain a unicode character (➜), and installing with PROMPT=hello seems to resolve it.

glanotte commented 11 years ago

heads up that this appears fully resolved in 0.10.0, thanks!