dub import local D package

Steven Schveighoffer schveiguy at gmail.com
Thu Apr 21 00:14:16 UTC 2022


On 4/20/22 7:39 PM, data pulverizer wrote:
> Hi all,
> 
> I'm trying to import a local dub package into a dub project (`json` 
> format). I have added the package I'm trying to import with `dub 
> add-local` and `dub add-path` and including it within the json file, but 
> I get the error
> 
> ```
> $ dub build
> Performing "debug" build using /.../ldc2/bin/ldc2 for x86_64.
> myPackageName 0.1.0: target for configuration "library" is up to date.
> test ~master: building configuration "application"...
> source/app.d(1,8): Error: module `mymodule` is in file 
> 'myPackageName/modules/mymodule.d' which cannot be read
> import path[0] = source/
> import path[1] = ../myPackageName/source/
> import path[2] = /.../ldc2/bin/../import
> /.../ldc2/bin/ldc2 failed with exit code 1.
> ```
> 
> The dependencies in the dub.json file looks like this:
> 
> 
> ```
>      "dependencies": {
>          "myPackageName": {
>              "path": "/.../myPackageName",
>              "version": "0.1.0"
>          }
>      }
> ```
> 
> Thanks in advance

Did you substitute something real with `...` to hide it from your post? 
Because that's not a real path.

Note that if you use path dependencies, you do not have to dub add-local 
the package.

-Steve


More information about the Digitalmars-d-learn mailing list