Documenter.jl expects my local project to be registered

I have a local project, say MyProject.
It has a docs directory with its own Project.toml file, which contains

[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
MyProject = "<UUID>"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"

I cd to the MyProject/docs folder, Pkg.activate it, and then upon Pkg.instantiateing it, I get the error

    Updating registry at `C:\Users\<USER>\.julia\registries\General.toml`
ERROR: expected package `MyPackage [<UUID>]` to be registered

I’ve gotten it to work on rare occasion, and afterwards it breaks itself.

The Documenter.jl documentation tells you to run locally with julia make.jl from the docs folder, but this doesn’t utilise the docs/Project.toml that other registered packages I’ve seen online use. I’ve had to add the dependent packages in the Julia 1.9 environment instead of the MyProject/docs environment. I’m quite confused.

Notes:

  • (MyProject) pkg> test runs successfully.
  • docs/make.jl has the needed push!(LOAD_PATH, "../src/").
  • The julia make.jl in Powershell (yes I’m using Windows) doesn’t seem to load my PlotsExt.jl package extension.

I think this happens because you didn’t pkg> dev your local package in the docs environment.
Try this in the Julia REPL from your project root

pkg> activate docs

pkg> rm MyProject

pkg> dev .

This tells the docs environment to look at the path . for your code instead of online. This information is not actually stored in the docs/Project.toml but in the docs/Manifest.toml, which is why it is important to commit docs/Manifest.toml even though you probably gitignore the main Manifest.toml.

You shouldn’t need this afterwards

4 Likes

Wow! Worked wonders, thank you!

1 Like

If you create your future packages with GitHub - JuliaCI/PkgTemplates.jl: Create new Julia packages, the easy way, this will even be done automatically :sunglasses:

1 Like

Well, I’ve must’ve messed it up when I first used it.
I’ve tried again from scratch, being more careful, and it works! Thank you.

1 Like