rebar eunit无法在erlang中找到包含库:最新的停靠容器

m0rkklqb  于 2022-12-08  发布在  Erlang
关注(0)|答案(1)|浏览(166)

I'm new to docker and erlang. I've installed docker and VSCode on my windows machine and I want to learn to develop erlang in the container, so I created Dockerfile:

FROM erlang:latest

WORKDIR /project

COPY . .

and .devcontainer directory with devcontainer.json file:

{
    "name": "Erlang dev container",
    "context": ".",
    "dockerFile": "Dockerfile",
    "settings": { 
        "terminal.integrated.shell.linux": "/bin/bash"
    },
    "extensions": []
}

After I opened my project folder in container I can issue bash commands and I can start erl but when I try to ask rebar to test my code with

rebar eunit

or

rebar3 eunit

I get error:

can't find include lib "eunit/lib/eunit.hrl"

What did I do wrong? Is the erlang:latest image supposed to be used for erlang development? How to fix it?

fhg3lkii

fhg3lkii1#

为了使用eunit,当我在shell中运行erlang程序(不使用docker)时,我使用了以下-include_lib指令:

-include_lib("eunit/include/eunit.hrl").

你似乎走的是另一条路:

eunit/lib/eunit.hrl

在容器中,我可以发出bash命令
然后使用bash命令搜索文件eunit.hrl
您始终可以复制文件eunit.hrl并将其放在rebar项目的src目录中,然后在模块中用途:

-include("eunit.hrl")

我是新来的。
如果最坏的情况发生,不要担心eunit,在你需要一个测试框架之前,有很多关于erlang的知识需要学习。

相关问题