เส้นทางไลบรารีสำหรับกระบวนการคอมไพล์แบบมิกซ์

หลังจากย้ายจากเครื่องมือควบคุมเวอร์ชัน brew ไปเป็น asdf สำหรับ Elixir และ Erlang ฉันยังคงไม่สามารถรวบรวมโปรเจ็กต์เก่าของฉันได้: ในกระบวนการคอมไพล์มันพยายามอ้างถึงไฟล์ Cellar lib ของ Brew ที่ไม่มีอยู่จริง:

MacBook-Pro% mix test
==> gettext
Compiling 1 file (.erl)
/usr/local/Cellar/erlang/21.3.2/lib/erlang/lib/parsetools-2.1.8/include/yeccpre.hrl:59: illegal pattern
/usr/local/Cellar/erlang/21.3.2/lib/erlang/lib/parsetools-2.1.8/include/yeccpre.hrl:60: variable 'Error' is unbound
/usr/local/Cellar/erlang/21.3.2/lib/erlang/lib/parsetools-2.1.8/include/yeccpre.hrl:60: variable 'Stacktrace' is unbound
/usr/local/Cellar/erlang/21.3.2/lib/erlang/lib/parsetools-2.1.8/include/yeccpre.hrl:63: variable 'Stacktrace' unsafe in 'try' (line 60)
/usr/local/Cellar/erlang/21.3.2/lib/erlang/lib/parsetools-2.1.8/include/yeccpre.hrl:64: variable 'Error' unsafe in 'try' (line 60)
/usr/local/Cellar/erlang/21.3.2/lib/erlang/lib/parsetools-2.1.8/include/yeccpre.hrl:64: variable 'Stacktrace' unsafe in 'try' (line 60)
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"

แม้ว่าจะไม่มีโฟลเดอร์ /usr/local/Cellar/erlang ก็ตาม

มิกซ์ใช้เส้นทางไปยัง erlang libs ภายนอกที่ไหนและจะเปลี่ยนสิ่งนั้นเพื่อใช้บันเดิลของ asdf ได้อย่างไร


person Roaring Stones    schedule 18.04.2019    source แหล่งที่มา


คำตอบ (1)


Erlang และ Elixir ใช้ไบนารีและ libs จากตัวแปรสภาพแวดล้อม $PATH ของคุณตามที่อธิบายไว้ที่นี่: https://elixir-lang.org/install.html#installing-erlang

โดยปกติแล้ว asdf จะถูกโหลดที่ส่วนท้ายของ $PATH ของคุณ ซึ่งหมายความว่าหากคุณยังคงติดตั้ง Erlang และ Elixir ผ่านทาง brew มันจะถูกโหลดก่อน อย่างไรก็ตาม โปรดตรวจสอบอีกครั้งว่ามีการติดตั้ง Erlang เวอร์ชันอื่นผ่านทาง Brew หรือไม่ คุณสามารถถอนการติดตั้งทุกเวอร์ชันได้ด้วยคำสั่ง brew uninstall erlang --force

ตั้งค่าเวอร์ชัน Erlang และ Elixir ในเครื่องใน root dir ของโปรเจ็กต์ของคุณด้วยคำสั่ง:

asdf local erlang 21.3.2
asdf local elixir 1.8.1-otp-21

เปลี่ยนเวอร์ชันตามสภาพแวดล้อมของคุณ

และสุดท้ายตรวจสอบว่า asdf กำลังโหลดเวอร์ชันที่ถูกต้องด้วยคำสั่ง asdf current หรือไม่ มันควรแสดงสิ่งที่ชอบ:

elixir         1.8.1-otp-21 (set by /path/to/project/.tool-versions)
erlang         21.3.2   (set by /path/to/project/.tool-versions)

เป็นทางเลือกสุดท้าย โปรดดูที่ https://asdf-vm.com/#/core-manage-asdf-vm?id=having-issues

person Leandro Cesquini Pereira    schedule 18.04.2019
comment
กรุณาเพิ่มส่วนที่เกี่ยวข้องจากลิงค์ของคุณที่นี่ - person JJJ; 19.04.2019