0

I wanted to run my first project with dub. I initialized the project with dub init sandbox', then ran it with dub run. But dub said this:
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.

I don't understand, why does it happen because I have source folder in my project. Here's a project tree:

  • sandbox
    • source
      • app.d
    • dub.json

And dub.json file:

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

EDIT: This is a whole output

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.
  • Doesn't happen here. Perhaps add the full shell transcript, and make sure you're running the command in the correct directory. – Vladimir Panteleev Feb 26 '21 at 13:51
  • I am running dub in 'sandbox' folder, where dub.json lies. Sorry, I don't fully understand, how to add the full shell transcript. –  Feb 26 '21 at 14:05
  • In a terminal, reproduce the problem from scratch, then select all the text in the terminal, including the commands you typed and the output (result) from running these commands, and add it to your question as a code block. – Vladimir Panteleev Feb 26 '21 at 18:11
  • Oh, I understood. Thanks, I'll change it! –  Feb 26 '21 at 18:22
  • Yeah, it's due to the weird characters in your path, as you've already figured out :) – Vladimir Panteleev Feb 26 '21 at 20:54
  • Anyway, thank you for your help! –  Feb 26 '21 at 21:07

2 Answers2

1

The problem is solved! Spaces in the path to the project were the reason! So, don't write paths like me: D:\DEVELOPMENT\[ D ]

0

Dub created a new project sub-folder with name sandbox. Assuming your original project folder was myproject, then you need to use dub run at myproject/sandbox. You can move the contents to the project root folder or run dub init at your desire project location, no second argument.