[英]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
. 我的根目录中有一个.exs脚本,我希望能够在命令行上执行,如
elixir my_script.exs
。 My script was working before I initialized Mix in my project but now it does not work. 在我的项目中初始化Mix之前,我的脚本正在运行,但现在它不起作用。 I can see that Mix is placing the .beam files in the
ebin/
directory but apparently my script is not looking in there. 我可以看到Mix将.beam文件放在
ebin/
目录中,但显然我的脚本没有在那里查找。
What is the proper way to load custom modules into a .exs script? 将自定义模块加载到.exs脚本的正确方法是什么?
You can run script like: mix run my_script.exs
您可以运行以下脚本:
mix run my_script.exs
OR 要么
mix compile
elixir -pa ebin/ my_script.exs
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.