shell - 使用 Mix 时 Elixir .exs 脚本 "module is not loaded and could not be found"

标签 shell module erlang elixir-mix elixir

我的根目录中有一个 .exs 脚本,我希望它能够在命令行上执行,例如 elixir my_script.exs .在我在项目中初始化 Mix 之前,我的脚本正在运行,但现在它不起作用。我可以看到 Mix 正在将 .beam 文件放在 ebin/ 中。目录,但显然我的脚本没有在那里查找。

将自定义模块加载到 .exs 脚本中的正确方法是什么?

最佳答案

您可以运行如下脚本:mix run my_script.exs
或者

mix compile
elixir -pa ebin/ my_script.exs 

关于shell - 使用 Mix 时 Elixir .exs 脚本 "module is not loaded and could not be found",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19644066/

相关文章:

ssl - 使用 ssl 在 Erlang 中将证书和 key 作为 der_bin() 传递

linux - 如何将返回/输入按键编码为发送到 SSH shell 的字符串?

bash - 如何使用 ack 查找包含两种模式的文件?

erlang - 当您调用 io :format in common_test, 时,它会去哪里?

perl - 关键字 `no` 在 Perl 中的实际作用是什么?

javascript - NodeJS : use module. 从另一个模块导出函数

Erlang: session 管理和超时

python - 如何执行 python 脚本并保持打开的 shell 以便在 VIM 中进行进一步测试

linux - Bash 脚本在文件中传递

python - 获取 "No Module Named Spotipy"