Error: Missing source file for JSON

Hi, on a fresh installation of Julia on Ubuntu 16.04, I cannot install packages. Each add Pkgname results in a

1 dependency errored. To see a full report either run import Pkg; Pkg.precompile() or load the package

and Pkg.precompile() always gives me

ERROR: The following 1 direct dependency failed to precompile:

JSON [682c06a0-de6a-54ab-a142-c8b1cf79cde6]

Error: Missing source file for JSON [682c06a0-de6a-54ab-a142-c8b1cf79cde6
Stacktrace:
[1] pkgerror(msg::String)
@ Pkg.Types /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Types.jl:55
[2] precompile(ctx::Pkg.Types.Context; internal_call::Bool, strict::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Pkg.API /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:1265
[3] precompile
@ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:921 [inlined]
[4] precompile#196
@ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:919 [inlined]
[5] precompile()
@ Pkg.API /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:919
[6] top-level scope
@ REPL[28]:1

Does someone have an idea on this ?

What is the output of

ENV["JULIA_PKG_PRECOMPILE_AUTO"]=0
import Pkg
Pkg.add("JSON")

?

Hi Fredrik, here is the output :

julia> ENV[“JULIA_PKG_PRECOMPILE_AUTO”]=0
0

julia> import Pkg

julia> Pkg.add(“JSON”)
Resolving package versions…
No Changes to ~/.julia/environments/v1.6/Project.toml
No Changes to ~/.julia/environments/v1.6/Manifest.toml

@fredrikekre But even after this, using JSON still outputs the same error (see the first message).

I am not sure if the problem persists, but I will try to answer for other people with the same problem.

Following the discussion here.

JSON package might be borked. Remove the JSON package from .julia/packages and then try installing JSON again.

To avoid this problem is recommended to use environments.

I was facing a similar problem and I removed completely .julia directory. Installing again the desired package worked