-
Notifications
You must be signed in to change notification settings - Fork 775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[elixir] Unable to load project dependencies via iex -S mix
#926
Comments
@thepeoplesbourgeois commands like |
Assuming that's the version that gets downloaded when you do Quick check: are you running bash, zsh, or other? |
...Huh. Now that I've asked someone to come look at the error I'm getting, I'm not getting the error anymore... I guess COVID-19 really has made work-from-home the new normal. (get vaccinated, for the love of Git) |
Hi, I just installed $ iex -S mix
Erlang/OTP 24 [erts-12.0.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]
** (SyntaxError) /Users/tommasosardelli/.asdf/shims/mix:5:54: syntax error before: "$@"
(elixir 1.12.3) lib/code.ex:1261: Code.require_file/2 $ cat ~/.asdf/shims/mix
#!/usr/bin/env bash
# asdf-plugin: elixir 1.11.4
# asdf-plugin: elixir 1.11.4-otp-23
# asdf-plugin: elixir 1.12.3-otp-24
exec /usr/local/opt/asdf/libexec/bin/asdf exec "mix" "$@" $ asdf current
elixir system /Users/tommasosardelli/.tool-versions
erlang system /Users/tommasosardelli/.tool-versions |
@cippaciong did you try running |
@Stratus3D I tried running I noticed that the error occurs when I'm using the "system" Elixir (installed with Homebrew) which is my Here is the output of OS:
Darwin MacBook-Pro-di-Tommaso.local 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64
SHELL:
GNU bash, version 5.1.8(1)-release (x86_64-apple-darwin20.3.0)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
ASDF VERSION:
v0.8.1
ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/usr/local/opt/asdf/libexec
ASDF INSTALLED PLUGINS:
elixir https://github.com/asdf-vm/asdf-elixir.git
erlang https://github.com/asdf-vm/asdf-erlang.git I installed both |
@cippaciong are you sure you've set the system version correctly? Does it point to the root of an elixir build? What does |
I'm not sure I understand what you mean with $ asdf current
elixir system /Users/tommasosardelli/.tool-versions
erlang system /Users/tommasosardelli/.tool-versions $ cat /Users/tommasosardelli/.tool-versions
elixir system
erlang system $ asdf which elixir
/usr/local/bin/elixir $ ls -l /usr/local/bin/elixir
lrwxr-xr-x 1 tommasosardelli admin 34 Sep 6 09:33 /usr/local/bin/elixir -> ../Cellar/elixir/1.12.3/bin/elixir
$ ls -l /usr/local/Cellar/elixir/1.12.3/bin/
total 40
-r-xr-xr-x 1 tommasosardelli staff 6332 Sep 5 10:02 elixir
-r-xr-xr-x 1 tommasosardelli staff 1326 Sep 5 10:02 elixirc
-r-xr-xr-x 1 tommasosardelli staff 805 Sep 5 10:02 iex
-r-xr-xr-x 1 tommasosardelli staff 49 Sep 5 10:02 mix $ /usr/local/bin/elixir --version
Erlang/OTP 24 [erts-12.0.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]
Elixir 1.12.3 (compiled with Erlang/OTP 24) |
Sorry @cippaciong , I was juggling a couple issues and confused myself. I was thinking you had a path version set, not a system version set. In this case I'd see what |
There you go @Stratus3D $ for f in elixir elixirc iex mix; do type -a $f && echo; done
elixir is /Users/tommasosardelli/.asdf/shims/elixir
elixir is /usr/local/bin/elixir
elixirc is /Users/tommasosardelli/.asdf/shims/elixirc
elixirc is /usr/local/bin/elixirc
iex is /Users/tommasosardelli/.asdf/shims/iex
iex is /usr/local/bin/iex
mix is /Users/tommasosardelli/.asdf/shims/mix
mix is /usr/local/bin/mix |
@cippaciong and if you invoke |
@Stratus3D invoking it with $ /usr/local/bin/iex -S /usr/local/bin/mix
Erlang/OTP 24 [erts-12.0.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]
Interactive Elixir (1.12.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> $ /usr/local/bin/iex -S mix
Erlang/OTP 24 [erts-12.0.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]
** (SyntaxError) /Users/tommasosardelli/.asdf/shims/mix:5:54: syntax error before: "$@"
(elixir 1.12.3) lib/code.ex:1261: Code.require_file/2 |
@cippaciong not sure what is going on. I don't have a system version of elixir configured so I don't have a good way to test this. This is definitely something I've heard from other people - see asdf-vm/asdf-elixir#62 for an example. I've not been able to nail down what the cause is. It may be a bug but it may not be. |
I see, I'll try to investigate further when I have some time. Thank you for your help @Stratus3D |
Based on your terminal output, it looks like you have duplication installations of elixir, elixirc, iex and mix.
|
For anyone getting this problem right after installing, I had this exact problem as when I'd installed Elixir and Erlang with asdf, I hadn't properly restarted my Terminal, instead just re-running |
@Stratus3D ╰─➤ iex -S mix run --no-start
** (SyntaxError) /Users/kuku/.asdf/shims/mix:22:18: syntax error before: '.'
|
22 | exec /Users/kuku/.asdf/bin/asdf exec "mix" "$@"
| ^
(elixir 1.15.2) lib/code.ex:1435: Code.require_file/2 When replacing the mix with a direct path it works: ╰─➤ iex -S ~/.asdf/installs/elixir/1.13.3-otp-24/bin/mix run --no-start 1 ↵
Erlang/OTP 24 [erts-12.3.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
==> my_app |
Interesting @SamJakob , can anyone else here test that and confirm is that fixes the issue? I believe this is the same issue as asdf-vm/asdf-elixir#111 so lets continue discussion there since that issue is still open. |
@Stratus3D I could confirm. issue happens
issue not happed with mix full path
|
Please keep all discussion on the open issue - asdf-vm/asdf-elixir#111 |
Describe the bug
When asdf has the Elixir plugin and any available version installed, running
iex -S mix [TASK]
fails, preventing a user from being able to load a project's package dependencies into the REPL, and/or from running any task (e.g.,deps.compile
,phx.server
) within the context of the REPL. The problem seems to stem from the way themix
shim loads Bash args (works as expected in zsh), as the error message on exit isTo Reproduce
Make sure you are executing in Bash:
Expected behavior
The terminal should have given you an output and prompt such as:
Actual behavior
You most likely saw the error as reported above.
I've narrowed down the shim as the definite source of the issue, as I produced the expected behavior example for this issue by running
$(asdf which iex) -S $(asdf which mix)
.Environment
asdf plugins affected (if relevant):
Just
asdf-elixir
, but it looks likeasdf-python
may have a similar issue? It doesn't seem to like it when I try to runpip --help
.Additional context
This is the first day of the rest of your life.
The text was updated successfully, but these errors were encountered: