为什么 dub 看不到源文件夹?



我想用dub来运行我的第一个项目。我用dub init sandbox'初始化项目,然后用dub run运行它。但dub说:
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.

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

  • 沙箱
    • 来源
      • app.d
    • dub.json

和配音。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.

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

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

相关内容

  • 没有找到相关文章

最新更新