简体   繁体   English

如何在 Windows 中获得最新版本的 Elixir

[英]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.我在一台 Windows 机器上,我希望在其中安装最新版本的 elixir。 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.最初我在 Windows 上搜索了类似于 asdf 的东西,但是这个平台没有类似的东西。 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: Scoop 是最接近的工具,但它需要我做自定义脚本并学习另一个工具,我现在不喜欢这两件事:

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

Then I turned to chocolatey:然后我转向巧克力:

https://community.chocolatey.org/packages?q=elixir 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.看起来很完美,但它已经严重过时了,仅在 11.X 版本中没有任何更新的信号,所以这个也已经过时了。

My last hope, is perhaps Docker …我最后的希望,也许是 Docker ……

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

It looks like there is a version of 12.X, which hopefully uses OTP 24 (my goal):看起来有一个 12.X 版本,希望使用 OTP 24(我的目标):

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.我对 Docker 容器的唯一体验是极其痛苦的。 I understand things have changed in the meantime and that Docker seems to be a solution most developers fight for.我知道在此期间情况发生了变化,而且 Docker 似乎是大多数开发人员争取的解决方案。

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?我能否使用容器为 Windows 创建版本?
  • Will I be able to create releases for Ubuntu as well?我也可以为 Ubuntu 创建发行版吗? (I am fairly sure I won't be able to because my host is Windows, but just confirming) (我很确定我不能,因为我的主机是 Windows,但只是确认)
  • Do you guys recommend any guides for Windows?你们有没有推荐的 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 :抱歉,我没有在 Windows 上使用 Elixir 的个人经验,但引用了官方网站的说明:

From the installer README :从安装程序自述文件

  • Downloads and installs the latest Elixir version, or another version the user selects下载并安装最新的 Elixir 版本,或用户选择的其他版本

Answer回答

This one was not easy.这一点并不容易。 I had to wait for the Windows binaries to be ready.我不得不等待 Windows 二进制文件准备就绪。 The only way of getting the cutting edge release is to compile it myself.获得最前沿版本的唯一方法是自己编译。

Step 1第1步

However, if this is something you can't do, to have the latest Erlang/OTP versions you have to go here:但是,如果这是你不能做的事情,要获得最新的 Erlang/OTP 版本,你必须去这里:

Here I downloaded Erlang/OTP 24.我在这里下载了 Erlang/OTP 24。

Step 2第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):之后,我下载了适用于 Windows 的 Elixir 官方版本,并将其配置为使用我已经安装的 Erlang/OTP 版本(默认情况下):

Step 3 (Optional)第 3 步(可选)

The final step, if you want to have a desktop app with Elixir, is to download the WebView support for Edge:最后一步,如果你想要一个带有 Elixir 的桌面应用程序,是下载对 Edge 的 WebView 支持:

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

Done !完毕 !

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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