简体   繁体   中英

How to have latest version of Elixir in Windows

Background

I am on a Windows machine and I am looking to install the latest version of elixir in it. This is being harder than expected.

Research

Initially I searched for something similar to asdf for Windows, but there is nothing similar for this platform. Scoop is the tool that comes closest, but it requires me to do custom scripts and to learn another tool, both things I am not a fan of right now:

https://elixirforum.com/t/elixir-version-manager-for-windows/39399/5

Then I turned to chocolatey:

https://community.chocolatey.org/packages?q=elixir

Which looks perfect, but it is severely outdated, being only in version 11.X No signal of any updates to come, so this one is out as well.

My last hope, is perhaps Docker …

https://hub.docker.com/_/elixir

It looks like there is a version of 12.X, which hopefully uses OTP 24 (my goal):

FROM erlang:24

# elixir expects utf8.
ENV ELIXIR_VERSION="v1.12.3" \
    LANG=C.UTF-8

RUN set -xe \
    && ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/archive/${ELIXIR_VERSION}.tar.gz" \
    && ELIXIR_DOWNLOAD_SHA256="c5affa97defafa1fd89c81656464d61da8f76ccfec2ea80c8a528decd5cb04ad" \
    && curl -fSL -o elixir-src.tar.gz $ELIXIR_DOWNLOAD_URL \
    && echo "$ELIXIR_DOWNLOAD_SHA256  elixir-src.tar.gz" | sha256sum -c - \
    && mkdir -p /usr/local/src/elixir \
    && tar -xzC /usr/local/src/elixir --strip-components=1 -f elixir-src.tar.gz \
    && rm elixir-src.tar.gz \
    && cd /usr/local/src/elixir \
    && make install clean \
    && find /usr/local/src/elixir/ -type f -not -regex "/usr/local/src/elixir/lib/[^\/]*/lib.*" -exec rm -rf {} + \
    && find /usr/local/src/elixir/ -type d -depth -empty -delete

CMD ["iex"]

Questions

However, I am not convinced yet. My only experiences with Docker containers were brutally painful. I understand things have changed in the meantime and that Docker seems to be a solution most developers fight for.

However, I am not sure if investing in this tool (remember, I discarded scoop because I didn't want to invest in it) is going to pay off:

  • Will I be able to create releases for Windows using a container?
  • Will I be able to create releases for Ubuntu as well? (I am fairly sure I won't be able to because my host is Windows, but just confirming)
  • Do you guys recommend any guides for Windows?

Alternatives

I feel like I am reaching for the bottom of the barrel here. I am honestly running out of options. Any ideas would be welcome.

Sorry I don't have personal experience with Elixir on Windows, but quoting the instructions from the official site :

From the installer README :

  • Downloads and installs the latest Elixir version, or another version the user selects

Answer

This one was not easy. I had to wait for the Windows binaries to be ready. The only way of getting the cutting edge release is to compile it myself.

Step 1

However, if this is something you can't do, to have the latest Erlang/OTP versions you have to go here:

Here I downloaded Erlang/OTP 24.

Step 2

After that, I downloaded the official version of Elixir for Windows, and configured it to use my already installed version of Erlang/OTP (which it does by default):

Step 3 (Optional)

The final step, if you want to have a desktop app with Elixir, is to download the WebView support for Edge:

https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/b97b52c3-9a66-419c-9ef0-90e3a3f72c5c/MicrosoftEdgeWebview2Setup.exe

Done !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM