Exadra37
Opening the source files from iex in the editor with `open` fails to find the file
From watching this Jose video https://youtu.be/suOzNeMJXl0?t=466 at minute 7:46 I see him opening the source file for Tuple.to_list from an iex session, but if a try to the same I get an error saying the file is not available:
docker run --rm -it hexpm/elixir:1.10.1-erlang-22.3.3-debian-buster-20200224 iex 130 ↵
Erlang/OTP 22 [erts-10.7.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]
Interactive Elixir (1.10.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> open Tuple.to_list
Could not open: "/usr/local/lib/elixir/bin/../lib/elixir/lib/tuple.ex". File is not available.
iex(2)>
or with the docker official image:
docker run --rm -it elixir
Erlang/OTP 22 [erts-10.7.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]
Interactive Elixir (1.10.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> open Tuple.to_list
Could not open: "/usr/local/lib/elixir/bin/../lib/elixir/lib/tuple.ex". File is not available.
If check the path in iex:
docker run --rm -it hexpm/elixir:1.10.1-erlang-22.3.3-debian-buster-20200224 iex
Erlang/OTP 22 [erts-10.7.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]
Interactive Elixir (1.10.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :code.which Tuple
'/usr/local/lib/elixir/bin/../lib/elixir/ebin/Elixir.Tuple.beam'
iex(2)>
We get a different path and file name. Why is this happening?
If we drop to bash shell the file is indeed in same path reported by :code.which Tuple
docker run --rm -it hexpm/elixir:1.10.1-erlang-22.3.3-debian-buster-20200224 bash
root@ff317b8171cc:/# ls -al /usr/local/lib/elixir/lib/elixir/ebin/Elixir.Tuple.beam
-rw-r--r-- 1 root root 3564 Apr 27 12:14 /usr/local/lib/elixir/lib/elixir/ebin/Elixir.Tuple.beam
So for some reason the function open doesn’t work in the same way as seen in the Jose video for the Elixir core, but if I try to open a file im my project it just works. I am wondering if this is anything related to be running Elixir installed in a MAC, that may use different folder structures to install Elixir when compared with Linux?
I also have the same issue when building docker images with Erlang and Elixir directly from Github releases.
To note that I don’t have Elixir installed in my host machine, because I never install any programming language or toolling in my host. Everything I can, runs from docker containers.
So I am curious if someone with Elixir installed in the Linux host is able to run open Tuple.to_list sucessefully?
Most Liked
gshaw
I needed to make two changes:
- Uninstall Erlang and Elixir from Homebrew and install using asdf
- Tell IEx how to use VS Code to jump to a line number:
export ELIXIR_EDITOR="code --goto __FILE__:__LINE__"
outlog
on mac with asdf I get:
iex(2)> open String.downcase
Could not open: “/Users/myuser/.asdf/installs/elixir/1.10.3-otp-22/bin/../lib/elixir/lib/string.ex”. Please set the ELIXIR_EDITOR or EDITOR environment variables with the command line invocation of your favorite EDITOR.
which gives us enough to find Using Elixir 1.5's open command with terminal Emacs - DockYard
so if I do export ELIXIR_EDITOR="subl" and then iex - open String.downcase works ![]()
Exadra37
Nice to know that for you is only missing the editor variable, but for us the error is another… doesn’t find the file ![]()
Something really different across setups. Would love to know what…
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









