DUB is not working correctly

Maxim mogulevmaxim at gmail.com
Wed Feb 24 16:46:20 UTC 2021


On Wednesday, 24 February 2021 at 16:27:49 UTC, evilrat wrote:
> On Wednesday, 24 February 2021 at 16:13:48 UTC, Maxim wrote:
>> Hello, I have problems with working in dub environment. If I 
>> try to init my project with 'dub init', all needed files will 
>> be created successfully. However, when I run 'dub run', the 
>> manager gives me an error:
>>
>> 'Configuration 'application' of package application 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.'
>>
>> If I set targetType in dub.json to "none", the only message:
>>  'Package with target type "none" must have dependencies to 
>> build.'
>>
>> will remain. When I set targetName to "app" or any other name, 
>> the problem will appear again with the same message above. I 
>> flicked through many forums and videos how to correctly 
>> install dub, and nothing helped.
>>
>> I am using dub 1.23.0 built on Sep 25 2020 on Windows 10 x64. 
>> Will be very thankful for your help!
>
> Doesn't seem like an installation problem.
>
> Could you post your dub.json contents and describe what you are 
> trying to achieve?
>
> Do you have your source files in 'src' or 'source' folder next 
> to the dub.json file? If not, you need to tell dub to treat any 
> other non conventional folder as source location.

Sure, here are dub.json contents:
{
	"authors": [
		"Max"
	],
	"copyright": "Copyright © 2021, Max",
	"description": "A minimal D application.",
	"license": "proprietary",
	"dependencies": {
		"dsfml": "~>2.1.1"
	},
	"targetType": "none",
	"targetName": "app",
	"name": "test"
}

I just want to run it by typing 'dub run'. But the error message 
says that I need to set targetType to none, add targetName and 
dependencies for it.

I have folder source next to dub.json. I'd better show you my 
project structure:

test
|  source
|     app.d
|  dub.json


More information about the Digitalmars-d-learn mailing list