【问题标题】:Can't run Phoenix server. Can't find erlang/lib/parsetools-2.1.8无法运行凤凰服务器。找不到 erlang/lib/parsetools-2.1.8
【发布时间】:2020-11-08 08:34:18
【问题描述】:
~/Desktop/phoenix_sandbox/app$ mix phx.server
==> gettext
Compiling 1 file (.yrl)
/usr/lib/erlang/lib/parsetools-2.1.8/include/yeccpre.hrl: no such file or directory

could not compile dependency :gettext, "mix compile" failed. You can recompile this dependency with "mix deps.compile gettext", update it with "mix deps.update gettext" or clean it with "mix deps.clean gettext"

我一直在绕着这个错误转。我安装了“解析工具”(不管它是什么)。如果我执行“mix deps.clean gettext”,它会带我转圈,我会得到同样的错误。我在 Ubuntu 上

【问题讨论】:

  • 你安装erlang了吗?以及您是如何安装 elixir 的?
  • 我按照 elixir 网站上的说明安装了 elixir 和 erlang。我遇到了一些其他问题,所以此时我可能已经安装了各种垃圾来试图解决这个问题。
  • 我会建议删除它并通过ASDF安装它..再试一次
  • 我得到了到处都是丢失包的错误。
  • 无论我做什么我都会得到“似乎没有安装所需的开发包'libncurses5-dev'。”并且:“ * 文档:* xsltproc 丢失。* fop 丢失。* xmllint 丢失。* 无法构建文档。”

标签: ubuntu elixir phoenix-framework


【解决方案1】:

需要erlang-dev包提供yeccpre.hrl

(apt-file 或 google for debian 的软件包 repo 可以帮助识别这些情况,这里是 erlang-dev 包含在 buster 中的文件列表,parsetools 版本不同,但是您的 erlang 软件包集应该为您纠正这个问题: https://packages.debian.org/buster/arm64/erlang-dev/filelist)

【讨论】:

    【解决方案2】:

    通过包管理器安装 Erlang 不是一个好方法,因为它们不会包含您需要的所有内容,有时它们会将一些库放在不应该出现的地方,然后一些工具就无法正常工作.

    我建议您改用 Erlang Solutions 版本,如果您不喜欢使用 Docker,那么您可以尝试在我的 Elixir Docker Stack 的Dockerfile 中复制我正在做的事情,或者只使用下面的 bash脚本。

    在 Ubuntu 18.04 中安装 Elixir Phoenix 堆栈

    我的 Elixir Docker Stack 是从我用来安装 Erlang、Elixir、Phoenix 和 NodeJS 的旧 bash 脚本开始的,因此为了您的方便,我将在此处添加它。

    将此 bash 文件 install-stack.sh 保存到您的计算机中:

    #!/bin/sh
    
    set -eu
    
    Main() {
    
        local ERLANG_VERSION=${1? Missing Erlang version. Check the latest version at https://www.erlang-solutions.com/resources/download.html}
        local ERLANG_DOWNLOAD_URL=https://packages.erlang-solutions.com/erlang/debian/pool/esl-erlang_${ERLANG_VERSION}-1~ubuntu~bionic_amd64.deb
    
        local ELIXIR_VERSION=${2? Missing Erlang version. Check the latest version at https://www.erlang-solutions.com/resources/download.html}
        local ELIXIR_DOWNLOAD_URL=https://packages.erlang-solutions.com/erlang/debian/pool/elixir_${ELIXIR_VERSION}-1~ubuntu~bionic_all.deb
    
        local PHOENIX_VERSION="${3? Missing Phoenix version to install!!!}"
    
        local NODEJS_VERSION="${4? Missing NodeJS version to install!!!}"
    
        apt update
        apt -y upgrade
        apt -y -q install --no-install-recommends \
            ca-certificates \
            curl \
            build-essential \
            procps \
            libncurses5 \
            libwxbase3.0-0v5 \
            libwxgtk3.0-0v5 \
            libsctp1
    
        apt -y -f install
    
        printf "\nERLANG DOWNLOAD URL: ${ERLANG_DOWNLOAD_URL}\n"
        curl -fsSL -o esl.deb "${ERLANG_DOWNLOAD_URL}"
        dpkg -i esl.deb
        rm -f esl.deb
    
        printf "\nELIXIR DOWNLOAD URL: ${ELIXIR_DOWNLOAD_URL}\n"
        curl -fsSL -o elixir.deb "${ELIXIR_DOWNLOAD_URL}"
        dpkg -i elixir.deb
        rm -f elixir.deb
    
        printf "\nPHOENIX VERSION: ${PHOENIX_VERSION}\n"
    
        # installs the package manager
        mix local.hex --force
    
        # installs rebar and rebar3
        mix local.rebar --force
    
        mkdir -p "${HOME}/bin"
        ln -s "${HOME}"/.mix/rebar "${HOME}"/bin/rebar
        ln -s "${HOME}"/.mix/rebar3 "${HOME}"/bin/rebar3
    
        mix archive.install --force hex phx_new ${PHOENIX_VERSION}
    
        # INSTALL NODEJS
        printf "\nNODEJS VERSION: ${NODEJS_VERSION}\n"
        curl -sL https://deb.nodesource.com/setup_"${NODEJS_VERSION}".x | sh -
        apt install -y -q --no-install-recommends nodejs
    }
    
    Main ${@}
    
    

    从您的系统中卸载 Erlang、Elixir 和 Phoenix。

    使用bash install-stack.sh <erlang-version> <elixir-version> <phoenix-version> <nodejs-version> 安装 Elixir Phoenix 堆栈:

    bash install-stack.sh 22.3.3 1.10.3 1.5.1 10
    

    现在测试它是否有效:

    mix phx.new hello --no-ecto && cd hello && mix test
    

    输出:

    ...
    
    Finished in 0.03 seconds
    3 tests, 0 failures
    
    ...
    

    脚本在 docker 容器中进行了测试:

    docker run --rm -it -v $PWD/install-stack.sh:/install-stack.sh ubuntu:18.04 bash
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-07-22
      • 1970-01-01
      • 2017-06-05
      • 1970-01-01
      • 2017-04-18
      • 1970-01-01
      • 1970-01-01
      • 2016-10-12
      相关资源
      最近更新 更多