I would not recommend having LD_LIBRARY_PATH in a general environment. As Mose said, it preempts everything else. I typically have it only in a script for running a specific piece of software if I need it to run with shared libraries that it can either not find or if I need to use with a distinct version of shared libraries. On a HPC system, maybe modules would manage it.
For software you build yourself, there should be other mechanisms for it to find the right libraries. In that case, I would only use LD_LIBRARY_PATH for debugging.
I am on a Windows 10 machine and just came across a similar problem. Everything was working find in a Pluto notebook and then I upgraded to Pluto v0.14.2, and I received a similar error. I then downgraded to v0.14.1 and nothing improved. I have stumbled upon this thread in trying to resolve the problem, tried some of the suggestions and so far no luck.
julia> using Plots
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
Your GR installation is incomplete. Rerunning build step for GR package.
ERROR: LoadError: LoadError: InitError: Evaluation into the closed module `GR` breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating `GR` with `eval` during precompilation - don't do this.
Stacktrace:
[1] eval
@ .\boot.jl:360 [inlined]
[2] __init__()
@ GR ~\.julia\packages\GR\qSS8e\src\GR.jl:311
[3] _include_from_serialized(path::String, depmods::Vector{Any})
@ Base .\loading.jl:674
[4] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
@ Base .\loading.jl:760
[5] _require(pkg::Base.PkgId)
@ Base .\loading.jl:998
[6] require(uuidkey::Base.PkgId)
@ Base .\loading.jl:914
[7] require(into::Module, mod::Symbol)
@ Base .\loading.jl:901
[8] include(mod::Module, _path::String)
@ Base .\Base.jl:386
[9] include(x::String)
@ Plots ~\.julia\packages\Plots\SVksJ\src\Plots.jl:1
[10] top-level scope
@ ~\.julia\packages\Plots\SVksJ\src\Plots.jl:218
[11] include
@ .\Base.jl:386 [inlined]
[12] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
@ Base .\loading.jl:1213
@ none:1
[14] eval
@ .\boot.jl:360 [inlined]
[15] eval(x::Expr)
@ Base.MainInclude .\client.jl:446
[16] top-level scope
@ none:1
during initialization of module GR
in expression starting at C:\Users\jakez\.julia\packages\Plots\SVksJ\src\backends\gr.jl:6
in expression starting at C:\Users\jakez\.julia\packages\Plots\SVksJ\src\Plots.jl:1
ERROR: Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to C:\Users\jakez\.julia\compiled\v1.6\Plots\jl_ED58.tmp.
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:33
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::Base.TTY, internal_stdout::Base.TTY)
@ Base .\loading.jl:1360
[3] compilecache(pkg::Base.PkgId, path::String)
@ Base .\loading.jl:1306
[4] _require(pkg::Base.PkgId)
@ Base .\loading.jl:1021
[5] require(uuidkey::Base.PkgId)
@ Base .\loading.jl:914
[6] require(into::Module, mod::Symbol)
@ Base .\loading.jl:901
julia> using GR
Your GR installation is incomplete. Rerunning build step for GR package.
Building GR → `C:\Users\jakez\.julia\scratchspaces\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\82a03d9c331d181bf33c99c9af04202cc4533d48\build.log`
Progress [========================================>] 11/11
? Plots
10 dependencies successfully precompiled in 23 seconds (208 already precompiled)
1 dependency failed but may be precompilable after restarting julia
[ Info: GR was successfully rebuilt
julia> using Plots
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
┌ Warning: Module GR with build ID 172841467714401 is missing from the cache.
│ This may mean GR [28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:1008
[ Info: Skipping precompilation since __precompile__(false). Importing Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80].
julia> julia> ENV["JULIA_GR_PROVIDER"] = "BinaryBuilder"
ERROR: syntax: "ENV["JULIA_GR_PROVIDER"]" is not a valid function argument name around REPL[4]:1
Stacktrace:
[1] top-level scope
@ REPL[4]:1
julia> julia> ENV["GRDIR"] = ""
ERROR: syntax: "ENV["GRDIR"]" is not a valid function argument name around REPL[5]:1
Stacktrace:
[1] top-level scope
@ REPL[5]:1
julia> ""
""
julia>
julia> julia> ENV["JULIA_GR_PROVIDER"] = "BinaryBuilder"
ERROR: syntax: "ENV["JULIA_GR_PROVIDER"]" is not a valid function argument name around REPL[7]:1
Stacktrace:
[1] top-level scope
@ REPL[7]:1
julia> using GR
julia> using Plots
julia>
julia> LD_LIRARY_PATH
ERROR: UndefVarError: LD_LIRARY_PATH not defined
julia> LD_LIBRARY_PATH
ERROR: UndefVarError: LD_LIBRARY_PATH not defined
julia>