-
Notifications
You must be signed in to change notification settings - Fork 70
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
Running iex -S mix phx.server
fails
#111
Comments
After installing Erlang 23.0 and Elixir 1.11.2 with asdf and using them instead of system installations then everything seems to work. |
@jarmo so this seems to be limited to when you tried to run Can you share the output of |
Yes, as soon as I don't specify
Now, before
|
Did you have Erlang and Elixir installed on your system prior to asdf? And did they work when you ran simple things like just |
Yes, Erlang 23.0 and Elixir 1.11.2 were installed before and I used When I comment out asdf in my Also, as mentioned when I install the same versions of Erlang and Elixir with asdf and set them as local versions for the same older project then everything works too so it's not that big of a problem that system installations will not work - I can even uninstall them since everything works with asdf too. |
Does this issue appear similar to yours? asdf-vm/asdf#1130 Also, what happens if you run |
Some additional information:
Also this:
|
This looks like the same issue - #62 Have you tried updating the plugin? |
No, I have not tried to update anything since I did install asdf and all of its plugins last week for the first time ever. |
Hmm... I'm out of ideas. What is the output of |
About other version managers - I have only chruby installed for managing Rubies, but not anything else for Elixir/Erlang. |
That all looks correct. chruby shouldn't be a problem. The only thing I can think of is maybe something is wrong with your shims and |
Nope, didn't help. Here's my shim for
I did read that WSL1 is not officially supported by asdf - can it be that this is the reason behind this problem although everything else seems to work as expected so far? |
No need to even execute
|
Yeah I'm at a loss. I have no idea what the issue is. You might check this issue tracker for others who have encountered issues on WSL. I am not familiar with WSL and it isn't officially supported by asdf as far as I know. |
I'm having a similar problem on Mac OS, where system versions of erlang, elixir and hex were installed before I added asdf. When I'm inside a Phoenix project and run Edit: It seems to be related to the line |
For me using |
Somehow, between outcommenting the the line |
@Stratus3D
This is why with Aside: |
@MathiasWedeken good to know. I use asdf and elixir every day and don't encounter this issue. I suspect there could be an environmental element to this issue. Perhaps something else on the path, or some iex configuration affects this behavior. But in any case if you follow the instructions in the asdf docs you should have a working setup. @AviKav asdf put its' shims on your |
Not all the time. While asdf's rc scripts amends
That would indeed be the case if
You mentioned half a year ago not having a |
I think you may be able to make asdf think you have a system install available by adding an elixir install to '$PATH' before sourcing asdf |
I'm pretty sure that I followed asdf instructions in the doc and did the same when installing Elixir/Erlang long before installing asdf. I don't think that I have done anything to steer off the path of "official" way of installing/loading either of these. I have created two Dockerfiles to reproduce this problem. First is a Docker file, which uses only system installation to show that it works as expected: # Dockerfile.system
FROM ubuntu
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update -y
RUN apt upgrade -y
RUN apt install -y wget
# System installation of Erlang and Elixir according to https://elixir-lang.org/install.html
RUN wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && apt install -y --fix-broken ./erlang-solutions_2.0_all.deb
RUN apt update -y
RUN apt install -y esl-erlang
RUN apt install -y elixir
WORKDIR /home/elixir
CMD iex -S mix help It works as expected: $ docker build -t elixir-test -f Dockerfile.system . && docker run --rm -it elixir-test
Erlang/OTP 24 [erts-12.3] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit]
...
Interactive Elixir (1.13.0) - press Ctrl+C to exit (type h() ENTER for help) Now, let's add Dockerfile for asdf: # Dockerfile.asdf
FROM ubuntu
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update -y
RUN apt upgrade -y
RUN apt install -y wget
# System installation of Erlang and Elixir according to https://elixir-lang.org/install.html
RUN wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && apt install -y --fix-broken ./erlang-solutions_2.0_all.deb
RUN apt update -y
RUN apt install -y esl-erlang
RUN apt install -y elixir
# asdf installation of Erlang and Elixir
RUN apt install -y curl git build-essential libssl-dev automake autoconf libncurses5-dev
RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.9.0
RUN echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc
RUN bash -ic "asdf plugin add erlang && \
asdf install erlang latest && \
asdf plugin add elixir && \
asdf install elixir latest"
WORKDIR /home/elixir
CMD bash -ic "asdf local erlang latest && asdf local elixir latest && iex -S mix help"
#CMD bash -ic "asdf local erlang system && asdf local elixir system && iex -S mix help" This also works as expected:
However, when you uncomment last $ docker build -t elixir-test -f Dockerfile.asdf . && docker run --rm -it elixir-test
** (SyntaxError) /root/.asdf/shims/mix:3:12: syntax error before: '.'
|
3 | exec /root/.asdf/bin/asdf exec "mix" "$@"
| ^
(elixir 1.13.0) lib/code.ex:1183: Code.require_file/2 Hope this helps. |
Thanks for the Dockerfile @jarmo ! That helps some, however I've got a coworker who has this same issue manifesting with regular versions, not system versions. Have you or anyone else here encountered that? |
@Stratus3D you're welcome about Dockerfiles. I've only encountered this issue as is happening with reproducible Dockerfiles above. Not had issues like that in any other way yet. |
Have same issue. |
Hitting this same issue, interestingly asdf worked correctly in one project, but not the other. There was a slight difference in the The non-working one:
The working one:
After changing |
I've experienced the same issue with |
I'm having this issue today and have never had a problem. I don't know what caused this. |
Fixed (YMMV): Okay, I don't know what was happening as I had just installed the versions of Elixir and Erlang I was using. I tried to reshim, and that didn't fix it. I decided to do |
I have the same problem with ASDF and elixir. Installed asdf the first time last Friday, today I needed to switch back to "system" elixir, added the system in tool-versions, did a Tool versions:
Reverting the path -- essentially cutting off ASDF -- "fixes" the problem. Was there ever a correct fix found? I seem to need my system erlang/elixir to get elixir-ls running again -- this is of course unrelated to this bug. |
Here's my
Here's what the shell's path resolver thinks. I'm using
|
Same issue with newest asdf & elixir & erlang when elixie is installed before asdf and use system version. |
Same problem. What I'd like is to default to the system versions of things and then have specific versions for some projects. I've got a global If I specify a specific version of Elixir, then everything works completely fine. Edit: Found a workaround: |
I just encountered the exact same issue and the reason for me was that my asdf elixir installation directory was completely empty but there was a system elixir that asdf seemingly was falling back to, causing the strange error. After uninstall re-installing the broken elixir version everything was fine again: > iex -S mix
Erlang/OTP 24 [erts-12.3.2.13] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
** (SyntaxError) /root/.asdf/shims/mix:3:12: syntax error before: '.'
|
3 | exec /root/.asdf/bin/asdf exec "mix" "$@" # asdf_allow: ' asdf '
| ^
(elixir 1.13.0) lib/code.ex:1183: Code.require_file/2
> cat .tool-versions
elixir 1.13.4-otp-24
> asdf install
elixir 1.13.4-otp-24 is already installed
> asdf list elixir
*1.13.4-otp-24
1.13.4
> ls ~/.asdf/installs/elixir/1.13.4-otp-24/
> asdf uninstall elixir 1.13.4-otp-24
> asdf install elixir 1.13.4-otp-24
> iex -S mix
Erlang/OTP 24 [erts-12.3.2.13] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
==> credo
Compiling 251 files (.ex)
...
(all fine now) |
Running
iex -S mix phx.server
fails:Running
mix phx.server
seems to work without any issues.Erlang and Elixir are
system
installations on Ubuntu 16.04.The text was updated successfully, but these errors were encountered: