简体   繁体   中英

Elixir .exs script “module is not loaded and could not be found” when using Mix

I have a .exs script in my root directory that I want to be able to execute on the command line like elixir my_script.exs . My script was working before I initialized Mix in my project but now it does not work. I can see that Mix is placing the .beam files in the ebin/ directory but apparently my script is not looking in there.

What is the proper way to load custom modules into a .exs script?

You can run script like: mix run my_script.exs

OR

mix compile
elixir -pa ebin/ my_script.exs 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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