0

我想用 dub 运行我的第一个项目。我用 ' 初始化项目dub init sandbox,然后用dub run. 但配音是这么说的:
Configuration 'application' of package sandbox contains no source files. Please add {"targetType": "none"} to its package description to avoid building it. Package with target type "none" must have dependencies to build.

我不明白,为什么会发生这种情况,因为我的项目中有源文件夹。这是一个项目树:

  • 沙盒
    • 来源
      • 应用程序.d
    • 配音.json

还有 dub.json 文件:

{
    "authors": [
        "MAX_PC"
    ],
    "copyright": "Copyright © 2021, MAX_PC",
    "description": "A minimal D application.",
    "license": "proprietary",
    "name": "sandbox"
}

编辑:这是一个完整的输出

D:\DEVELOPMENT\[ D ]>dub init sandbox
Package recipe format (sdl/json) [json]:
Name [sandbox]:
Description [A minimal D application.]:
Author name [MAX_PC]:
License [proprietary]:
Copyright string [Copyright ┬й 2021, MAX_PC]:
Add dependency (leave empty to skip) []:
Successfully created an empty project in 'D:\DEVELOPMENT\[ D ]\sandbox'.
Package successfully created in sandbox

D:\DEVELOPMENT\[ D ]>cd sandbox

D:\DEVELOPMENT\[ D ]\sandbox>dub run
Configuration 'application' of package sandbox contains no source files. Please add {"targetType": "none"} to its package description to avoid building it.
Package with target type "none" must have dependencies to build.
4

2 回答 2

1

问题已经解决了!项目路径中的空间是原因!所以,不要像我一样写路径:D:\DEVELOPMENT\[ D ]

于 2021-02-26T19:37:34.683 回答
0

Dub 创建了一个名为 的新项目子文件夹sandbox。假设你原来的项目文件夹是myproject,那么你需要使用dub runat myproject/sandbox。您可以将内容移动到项目根文件夹或在您想要的项目位置运行 dub init,无需第二个参数。

于 2021-02-26T14:04:40.877 回答