Module import failing after $ dub add mypackage

Scotpip geoff at variosoft.co.uk
Fri Jul 16 15:31:49 UTC 2021


Another newbie question I'm afraid.

Trying to import and use my first package from the registry.

I installed D from the Windows dmd-2.097.0.exe

I created the project with ```$ dub init myproject```

In the project root I've run:

```
$ dub add msgpack-d
   Adding dependency msgpack-d ~>1.0.3
```

In dub.sdl I see: ```dependency "msgpack-d" version="~>1.0.3"```

In dub.selections.json I see:

```
{
	"fileVersion": 1,
	"versions": {
		"msgpack-d": "1.0.3"
	}
}
```

When I try to import the msgpack  into my app.d main file, I get 
the error:

```
$ Error: module `msgpack` is in file 'msgpack.d' which cannot be 
read
   import path[0] = C:\D\dmd2\windows\bin64\..\..\src\phobos
   import path[1] = 
C:\D\dmd2\windows\bin64\..\..\src\druntime\import
```

I get similar errors whether I build with dub, dmd or rdmd.

The file msgpack.d which the build is searching for doesn't 
appear to be on my system.

I'm on Windows 10 Pro, if that's relevant. Importing my own local 
modules and modules from std is working fine.

I've looked at the docs and a couple of books but there's nothing 
to suggest how I can fix this. The official dub docs are sparse, 
to say the least and don't say anything about how dub works or 
where it stores its resources...

I've used many package managers without running into a roadblock 
like this. Am I doing something stupid?

I'm completely stuck till I can get this fixed, so any help would 
be very much appreciated!


More information about the Digitalmars-d-learn mailing list