# Adding a package from local directory gives strange results

**URL:** <https://discourse.julialang.org/t/adding-a-package-from-local-directory-gives-strange-results/60010>\
**Category:** New to Julia\
**Created:** [April 26, 2021, 1:21am UTC](https://discourse.julialang.org/t/adding-a-package-from-local-directory-gives-strange-results/60010 "2021-04-26T01:21:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deduction42](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/deduction42/32/9206_2.png) [@Deduction42](https://discourse.julialang.org/u/Deduction42)\
**Post date:** [April 26, 2021, 1:21am UTC](https://discourse.julialang.org/t/adding-a-package-from-local-directory-gives-strange-results/60010/1 "2021-04-26T01:21:52Z")

</div>

I’m trying to transition a web-server project I wrote to a package so that I can use packagecompiler.jl to precompile it and reduce startup latency. I would like to test the package precompiliation locally in a docker container. However, I’m getting stuck at adding the package.

If I do

```julia
pkgPath = joinpath(@ __DIR__ , "CCG_Server")
union!(LOAD_PATH, [pkgPath])
using CCG_Server
CCG_Server.SERVER_ENV

```

Everything works as expected (although it takes a while to precompile) and it displays the local constant SERVER\_ENV. However, if I rebuild the docker container and do

```julia
import Pkg
import Pkg.PackageSpec
pkgPath = joinpath(@ __DIR__ , "CCG_Server")
Pkg.add(PackageSpec(path=pkgPath))
using CCG_Server
CCG_Server.SERVER_ENV

```

The package loading is _ **suspiciously fast** _ and when all is done, it says that “UndefVarError: SERVER\_ENV not defined”. In fact NONE of the functions in CCG\_Server exist. It seems like it’s only a recursive field

```julia
names(CCG_Server.CCG_Server.CCG_Server.CCG_Server.CCG_Server)
1-element Vector{Symbol}:
 :CCG_Server

```

What happened? I have the Project.toml file set up with the deps and everything. Is there something I’m missing?

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [April 26, 2021, 5:55am UTC](https://discourse.julialang.org/t/adding-a-package-from-local-directory-gives-strange-results/60010/2 "2021-04-26T05:55:51Z")

</div>

`Pkg.add` of a local path is rarely something you want. It makes a snapshot of what has been _committed_ to the git repository at the local path and uses that as your package. You probably want to use whatever code is currently visible at the path and then it’s `Pkg.develop` of the local path you should use.

---

<div class="post-metadata">

**Author:** ![Deduction42](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/deduction42/32/9206_2.png) [@Deduction42](https://discourse.julialang.org/u/Deduction42)\
**Post date:** [April 26, 2021, 2:30pm UTC](https://discourse.julialang.org/t/adding-a-package-from-local-directory-gives-strange-results/60010/3 "2021-04-26T14:30:50Z")

</div>

That was the missing piece, everything else came together perfectly! THANK YOU! I admit that was something I was going to try and should have tried earlier; I just doubted that Pkg.develop would be compatible with packagecompiler.jl, but it turns out that they are COMPLETELY compatible. This will save a LOT of startup time for my server application.
