mgwidmann
A while back I made a PR to fix how .iex.exs worked so that it loaded the global/project versions correctly.
https://github.com/elixir-lang/elixir/pull/3824
It was denied because it was not backwards compatible.
Still today, if you have an .iex.exs file that contains an import statement like the following, it crashes.
import Ecto.Query
Causes
$ iex ‹ruby-2.3.1›
Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Interactive Elixir (1.2.5) - press Ctrl+C to exit (type h() ENTER for help)
Error while evaluating: /Users/mattwidmann/code/elixir/my_project/.iex.exs
** (CompileError) .iex.exs:3: module Ecto.Query is not loaded and could not be found
Does anyone else have this trouble? Would there be support for fixing these things in 1.3 or later?
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Kia ora,
We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Hello,
I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter).
The diffic...
New
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
Other Trending Topics
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
ICal is a library for interacting with iCalendar data. It parses iCalendars into typed Elixir structs via ICal.from_ics, and can prepare ...
New
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
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #phoenix_html
- #elixirconf-us
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
wojtekmach
I think you’d need to run
iex -S mixto use non-stdlib code in your.iex.exs. See: ** (CompileError) iex: undefined function from/2, inadequate error message · Issue #1665 · phoenixframework/phoenix · GitHubbenwilson512
I too would like a solution to this. It is often very convenient to have imports on my .iex.exs but doing so prevents a bare $ iex session which is rather inconvenient. I’ve tried a variety of ways to no avail I’m afraid.
mgwidmann
@wojtekmach yes I’m aware. The problem isn’t with running iex -S mix, but rather the bare iex session as @benwilson512 mentioned. Sometimes I don’t want to start up the app and start the supervision tree. I just want to run something in the standard library.
@benwilson512 I have found a way to work, but I’d rather not have to have that hack in there. I can’t find the hack now but I think I had to either check function_exported?/2 or something like that. Not sure if that will work or not, I do remember it being one of the things I tried though as well as catching the exception by the failed import.
ubernil
You can always use “iex -S mix run --no-start” to have all your project code and dependencies loaded, but no applications started.
benwilson512
This still requires that the code compile. Yes I realize that there is a no compile flag. With every required flag the convenience decreases. At this point I just have aliases in my .iex.exs. A real solution that allows a regular iex call would be best.
mgwidmann
I think the real problem is as @benwilson512 stated, allowing a bare iex session even if the .iex.exs can’t be compiled.
Additionally it’d be nice to do something like my rejected PR did, which allows proper handling of the global .iex.exs when present.
mgwidmann
Do you think iex should just print a warning or compiler error when you start it up and continue loading?
minhajuddin
May not be the perfect solution but you could override the .iex.ex file like below
Using this alias
bare-iexshould work without loading the.iex.exsfilemgwidmann
Thats a great workaround, but I’d like to see an official solution to this problem.
When I get some time, I may submit a PR to allow compiling to fail when loading iex and just have it print out the exception. It’d be noisy but it would at least work that way.
josevalim
In Elixir v1.3, you can do import_if_available and import_file_if_available. Both will be a no-op if the module or the file do not exist. Both should fix all problems mentioned in this thread.