# Problem using Documenter.jl

**URL:** <https://discourse.julialang.org/t/problem-using-documenter-jl/29052>\
**Category:** General Usage\
**Tags:** documenter\
**Created:** [September 22, 2019, 10:51pm UTC](https://discourse.julialang.org/t/problem-using-documenter-jl/29052 "2019-09-22T22:51:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ARYADEEPTA\_DE](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aryadeepta_de/32/10416_2.png) [@ARYADEEPTA\_DE](https://discourse.julialang.org/u/ARYADEEPTA_DE)\
**Post date:** [September 22, 2019, 10:51pm UTC](https://discourse.julialang.org/t/problem-using-documenter-jl/29052/1 "2019-09-22T22:51:23Z")

</div>

I am doing a project in julia, and was attempting to use doctest.jl for documentation. I was following the [intstructions on github](https://github.com/JuliaDocs/Documenter.jl/blob/master/docs/src/man/guide.md), and had everything working until running make.jl from the docs directory. Here is the code I used:

```julia
julia> cd("C:\\Arya's desktop\\Arya\\Programming\\Julia\\ConsistentSampler\\docs")

julia> make.jl
ERROR: UndefVarError: make not defined

```

Here is my folder structure:  
C:\Arya’s desktop\Arya\Programming\Julia\ConsistentSampler\src: consistent\_sampler.jl, demo\_consistent\_sampler.jl  
C:\Arya’s desktop\Arya\Programming\Julia\ConsistentSampler\docs: index.md, make.jl  
C:\Arya’s desktop\Arya\Programming\Julia\ConsistentSampler\docs\src: empty

Could anyone please let me know what to do?

---

<div class="post-metadata">

**Author:** ![Amin\_Yahyaabadi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amin_yahyaabadi/32/9826_2.png) [@Amin\_Yahyaabadi](https://discourse.julialang.org/u/Amin_Yahyaabadi)\
**Post date:** [September 22, 2019, 10:55pm UTC](https://discourse.julialang.org/t/problem-using-documenter-jl/29052/2 "2019-09-22T22:55:54Z")

</div>

You should use `include("make.jl")`.

A full working example is available here: [MatLang/docs at master · juliamatlab/MatLang · GitHub](https://github.com/juliamatlab/MatLang/tree/master/docs)

Follow my instructions here:

it is better to have two `make.jl` and `makeLocal.jl`. `makeLocal.jl` can be the same as this link’s code:

> <https://github.com/juliamatlab/MatLang/blob/99b9cc2286ce5d735bb1249a16564ea222be1b92/docs/makeLocal.jl#L19>

But for `make.jl`, we should remove 1st 4 lines of code

My instructions are as follows:

## To build the documentation locally

### Running inside Julia REPL:

cd to docs folder `cd("path to docs\\MatLang\\docs")` and run the following command:

```julia-auto
include("makeLocal.jl") 

```

### Running inside OS Terminal:

cd to docs folder using OS terminal and run the following command (Julia path should be added to OS path):

```julia-auto
julia --color=yes makeLocal.jl

```

Alternatively, you can use make.jl but using the following method:  
cd to package folder using OS terminal and run the following commands:

```julia-auto
julia -e 'using Pkg; Pkg.activate(); push!(LOAD_PATH, pwd());'
julia --project=docs/ -e 'using Pkg; Pkg.activate(); push!(LOAD_PATH,pwd());'

julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate();'
julia --project=docs/ --color=yes docs/make.jl

```

## To build the documentation online using Travis

Use this Travis script:

```julia-auto
- julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd()));
                                               Pkg.instantiate()'
- julia --project=docs/ docs/make.jl

```

---

<div class="post-metadata">

**Author:** ![ARYADEEPTA\_DE](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aryadeepta_de/32/10416_2.png) [@ARYADEEPTA\_DE](https://discourse.julialang.org/u/ARYADEEPTA_DE)\
**Post date:** [September 22, 2019, 11:21pm UTC](https://discourse.julialang.org/t/problem-using-documenter-jl/29052/3 "2019-09-22T23:21:32Z")

</div>

Thank you so much. It works. You are a life saver!🙏

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [September 23, 2019, 5:17am UTC](https://discourse.julialang.org/t/problem-using-documenter-jl/29052/4 "2019-09-23T05:17:09Z")

</div>

> [@Amin\_Yahyaabadi](#):
>
> it is better to have two `make.jl` and `makeLocal.jl` . `makeLocal.jl`

This is generally not needed, you can just start your `julia` process with that project activated, eg

```julia
julia --project=@. make.jl

```

when you are in `docs/`.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [September 23, 2019, 6:54am UTC](https://discourse.julialang.org/t/problem-using-documenter-jl/29052/5 "2019-09-23T06:54:02Z")

</div>

> [@Amin\_Yahyaabadi](#):
>
> julia -e ‘using Pkg; Pkg.activate(); push!(LOAD\_PATH, pwd());’  
> julia --project=docs/ -e ‘using Pkg; Pkg.activate(); push!(LOAD\_PATH,pwd());’

Neither of those lines does anything persistent, and are not needed.

---

<div class="post-metadata">

**Author:** ![Amin\_Yahyaabadi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amin_yahyaabadi/32/9826_2.png) [@Amin\_Yahyaabadi](https://discourse.julialang.org/u/Amin_Yahyaabadi)\
**Post date:** [September 23, 2019, 7:06am UTC](https://discourse.julialang.org/t/problem-using-documenter-jl/29052/6 "2019-09-23T07:06:58Z")

</div>

> [@Amin\_Yahyaabadi](#):
>
> julia --project=docs/ -e ‘using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate();’

Without those, user will run into errors:  
Ruining 3rd line without the first two:

```julia
julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate();'

```

```julia
ERROR: expected a `name` entry in project file at C:\Users\yahyaaba\Documents\GitHub\MatLang\docs\Project.toml
Stacktrace:
 [1] pkgerror(::String) at C:\Julia-1.2.0\share\julia\stdlib\v1.2\Pkg\src\Types.jl:112
 [2] (::getfield(Pkg.Types, Symbol("#_throw_package_err#69")){String})(::String) at C:\Julia-1.2.0\share\julia\stdlib\v1.2\Pkg\src\Types.jl:455
 [3] read_package(::String) at C:\Julia-1.2.0\share\julia\stdlib\v1.2\Pkg\src\Types.jl:458
 [4] parse_package!(::Pkg.Types.Context, ::Pkg.Types.PackageSpec, ::String) at C:\Julia-1.2.0\share\julia\stdlib\v1.2\Pkg\src\Types.jl:734
 [5] explicit_dev_path(::Pkg.Types.Context, ::Pkg.Types.PackageSpec) at C:\Julia-1.2.0\share\julia\stdlib\v1.2\Pkg\src\Types.jl:524
 [6] handle_repos_develop!(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}, ::Bool) at C:\Julia-1.2.0\share\julia\stdlib\v1.2\Pkg\src\Types.jl:592
 [7] #develop#17(::Bool, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(Pkg.API.develop), ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at C:\Julia-1.2.0\share\julia\stdlib\v1.2\Pkg\src\API.jl:54
 [8] develop at C:\Julia-1.2.0\share\julia\stdlib\v1.2\Pkg\src\API.jl:39 [inlined]
 [9] #develop#16 at C:\Julia-1.2.0\share\julia\stdlib\v1.2\Pkg\src\API.jl:36 [inlined]
 [10] develop at C:\Julia-1.2.0\share\julia\stdlib\v1.2\Pkg\src\API.jl:36 [inlined]
 [11] #develop#12 at C:\Julia-1.2.0\share\julia\stdlib\v1.2\Pkg\src\API.jl:33 [inlined]
 [12] develop(::Pkg.Types.PackageSpec) at C:\Julia-1.2.0\share\julia\stdlib\v1.2\Pkg\src\API.jl:33
 [13] top-level scope at none:1

```

---

<div class="post-metadata">

**Author:** ![Amin\_Yahyaabadi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amin_yahyaabadi/32/9826_2.png) [@Amin\_Yahyaabadi](https://discourse.julialang.org/u/Amin_Yahyaabadi)\
**Post date:** [September 23, 2019, 7:07am UTC](https://discourse.julialang.org/t/problem-using-documenter-jl/29052/7 "2019-09-23T07:07:51Z")

</div>

This gives an error:

```julia
 julia --project=@. make.jl

```

ERROR: LoadError: ArgumentError: Package MatLang [05b439c0-bb3c-11e9-1d8d-1f0a9ebca87a] is required but does not seem to be installed:

- Run `Pkg.instantiate()` to install all recorded dependencies.

Stacktrace:  
[1] \_require(::Base.PkgId) at .\loading.jl:982  
[2] require(::Base.PkgId) at .\loading.jl:911  
[3] require(::Module, ::Symbol) at .\loading.jl:906  
[4] include at .\boot.jl:328 [inlined]  
[5] include\_relative(::Module, ::String) at .\loading.jl:1094  
[6] include(::Module, ::String) at .\Base.jl:31  
[7] exec\_options(::Base.JLOptions) at .\client.jl:295  
[8] \_start() at .\client.jl:464  
in expression starting at C:\Users\yahyaaba\Documents\GitHub\MatLang\docs\make.jl:1

```julia

```

---

<div class="post-metadata">

**Author:** ![Amin\_Yahyaabadi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amin_yahyaabadi/32/9826_2.png) [@Amin\_Yahyaabadi](https://discourse.julialang.org/u/Amin_Yahyaabadi)\
**Post date:** [September 23, 2019, 7:09am UTC](https://discourse.julialang.org/t/problem-using-documenter-jl/29052/8 "2019-09-23T07:09:04Z")

</div>

The code that I wrote works for any situation, no matter if the package is installed or not. That is what a beginner needs.

---

<div class="post-metadata">

**Author:** ![mortenpi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mortenpi/32/158_2.png) [@mortenpi](https://discourse.julialang.org/u/mortenpi)\
**Post date:** [September 23, 2019, 7:36am UTC](https://discourse.julialang.org/t/problem-using-documenter-jl/29052/9 "2019-09-23T07:36:40Z")

</div>

> [@Amin\_Yahyaabadi](#):
>
> Without those, user will run into errors:  
> Ruining 3rd line without the first two:

No they don’t. The error you’re seeing is because you were already in the `docs/` directory when you called that line. The error is thrown by the `Pkg.develop` call, which tries to develop the `docs/Project.toml` (implying that `pwd()` was already `docs/`). That fails as it is not a package and is missing the `name` entry.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [September 23, 2019, 7:51am UTC](https://discourse.julialang.org/t/problem-using-documenter-jl/29052/10 "2019-09-23T07:51:18Z")

</div>

Yes, the implicit assumption is that you have `dev`ed your package in the global environment.

See

> [@PSA: Use a project for building your docs](https://discourse.julialang.org/t/psa-use-a-project-for-building-your-docs/14974):
>
> This is a simple guide on how to best build your documentation in Julia v1.0 if you are using Documenter. The old way If you are using Documenter you probably have something like the following in your .travis.yml file for building your documentation: after\_success: - julia -e 'Pkg.add("Documenter")' - julia -e 'cd(Pkg.dir("PACKAGE\_NAME")); include(joinpath("docs", "make.jl"))' Why is this bad? Here are some reasons: There is no good way to add doc-build dependencies, you have to add th…

for the recommended setup.
