Thread overview
Dub can't find and download packages
Aug 05, 2020
vanaur
Aug 06, 2020
Mike Parker
Aug 06, 2020
vanaur
August 05, 2020
Hello.

I'm starting to use D, and therefore Dub.
I didn't find a more suitable category than this one in the forum to ask my question, I'm sorry if it is not the most suitable.

My concern is thus the following: I can't add packages to my project, Dub warns me that they are not available.
For the example, I try to add this dependency (https://code.dlang.org/packages/pegged) with the following command:  dub add pegged . Dub then returns an error:

> Failed to get versions for package pegged on provider registry at https://code.dlang.org/ (fallbacks registry at https://codemirror.dlang.org/, registry at https://dub.bytecraft.nl/, registry at https://code-mirror.dlang.io/): Failed to download https://code.dlang.org/api/packages/infos?packages=%5B%22pegged%22%5D&include_dependencies=true&minimize=true
> Could not find package 'pegged'.

My project was initialized correctly with Dub (dub init... + the whole procedure). I also tried to add the dependency manually, in dub.sdl:

  dependency "pegged" version="~>0.4.2"

But it doesn't change anything.
Why doesn't it work? What do I need to do to get Dub to download and add dependencies?

Thanks in advance.

PS: how do you write blocks of code and insert links in forum posts? I've tried the makefile syntax, but it doesn't work. Thanks too!
August 06, 2020
On Wednesday, 5 August 2020 at 17:32:49 UTC, vanaur wrote:
>
> My concern is thus the following: I can't add packages to my project, Dub warns me that they are not available.
> For the example, I try to add this dependency (https://code.dlang.org/packages/pegged) with the following

> command:  dub add pegged . Dub then returns an error:
>
>> Failed to get versions for package pegged on provider registry at https://code.dlang.org/ (fallbacks registry at https://codemirror.dlang.org/, registry at https://dub.bytecraft.nl/, registry at https://code-mirror.dlang.io/): Failed to download https://code.dlang.org/api/packages/infos?packages=%5B%22pegged%22%5D&include_dependencies=true&minimize=true
>> Could not find package 'pegged'.
>
> My project was initialized correctly with Dub (dub init... + the whole procedure). I also tried to add the dependency manually, in dub.sdl:
>
>   dependency "pegged" version="~>0.4.2"
>
> But it doesn't change anything.
> Why doesn't it work? What do I need to do to get Dub to download and add dependencies?

You're doing it right. It's possible that the servers were down (though it would be a rare circumstance for the fallbacks to be down). Or there might be an issue with pegged specifically. Have you tried it since? Does it work for other packages?

>
> PS: how do you write blocks of code and insert links in forum posts? I've tried the makefile syntax, but it doesn't work.

This is a web frontend for plain-text newsgroups at nntp://news.digitalmars.com, which also has a mailing list frontend. So it doesn't support fancy code formatting. If you'd like, you can set the code off with Markdown-style backticks:

```
// Some code
```

It's a common idiom here. And, one day, the web frontend may get the ability to display such code blocks in a formatted manner.

As for links, just paste the plain-text link and the forum software will linkify it. It's common to use a Markdown-style footnote. So, for example, I might recommend like this that you visit dlang.org [1].

Alternatively, you could put the link on a new line:

https://dlang.org/

Up to you.

[1]: https://dlang.org/




August 06, 2020
Thank you for your comments :)

I tried again this morning, and the problem persisted... I have just reinstalled my D environment. It must have been badly installed, because now everything is working normally.

Looking at the installation files, I saw that there was a dependency to libcurl. Maybe it hadn't been installed correctly before. To convince myself of this, I simply removed the dynamic library from dub binary, and recovered the same error as in my original post. So there you go, the problem seems to be solved now.

It's strange, I had done the same installation...

On Thursday, 6 August 2020 at 11:38:08 UTC, Mike Parker wrote:
> This is a web frontend for plain-text newsgroups at nntp://news.digitalmars.com, which also has a mailing list frontend. So it doesn't support fancy code formatting. If you'd like, you can set the code off with Markdown-style backticks:
> 
> ```
> // Some code
> ```
> 
> It's a common idiom here. And, one day, the web frontend may get the ability to display > such code blocks in a formatted manner.
> 
> As for links, just paste the plain-text link and the forum software will linkify it. It's common to use a Markdown-style footnote. So, for example, I might recommend like this that you visit dlang.org [1].
> 
> Alternatively, you could put the link on a new line:
> 
> https://dlang.org/
> 
> Up to you.
> 
> [1]: https://dlang.org/

I will apply the conventions of the forum then, thank you :)