Dub can't find and download packages

Mike Parker aldacron at gmail.com
Thu Aug 6 11:38:08 UTC 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:


Up to you.

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

More information about the Digitalmars-d-learn mailing list