Installation of NodeJS fails: directory not empty

The installation of Franklin.jl fails trying to install NodeJS. The artifacts folder for nodejs_app appears however empty after the error message is displayed.

(tmp) pkg> st
Status `C:\Users\michele.zaffalon\tmp\Project.toml` (empty project)

(tmp) pkg> add NodeJS
   Resolving package versions...
  Downloaded artifact: nodejs_app
ERROR: IOError: rm("C:\\Users\\michele.zaffalon\\.julia\\artifacts\\jl_Y9gBTl"): directory not empty (ENOTEMPTY)
Stacktrace:
  [1] uv_error
    @ .\libuv.jl:100 [inlined]
  [2] rm(path::String; force::Bool, recursive::Bool)
    @ Base.Filesystem .\file.jl:307
  [3] rm
    @ .\file.jl:273 [inlined]
  [4] download_artifact(tree_hash::Base.SHA1, tarball_url::String, tarball_hash::Nothing; verbose::Bool, quiet_download::Bool, io::Base.TTY)
\src\Artifacts.jl:376
  [5] download_artifact (repeats 2 times)
    @ C:\Users\michele.zaffalon\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Pkg\src\Artifacts.jl:297 [inlined]
  [6] #22
    @ C:\Users\michele.zaffalon\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Pkg\src\Artifacts.jl:423 [inlined]
  [7] with_show_download_info(f::Pkg.Artifacts.var"#22#24"{Bool, Bool, Base.TTY, Base.SHA1, String}, io::Base.TTY, name::String, quiet_download::Bool)
    @ Pkg.Artifacts C:\Users\michele.zaffalon\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Pkg\src\Artifacts.jl:480
  [8] ensure_artifact_installed(name::String, meta::Dict{String, Any}, artifacts_toml::String; platform::Base.BinaryPlatforms.Platform, verbose::Bool, quiet_download::Bool, io::Base.TTY)
    @ Pkg.Artifacts C:\Users\michele.zaffalon\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Pkg\src\Artifacts.jl:422
  [9] download_artifacts(env::Pkg.Types.EnvCache; platform::Base.BinaryPlatforms.Platform, julia_version::VersionNumber, verbose::Bool, io::Base.TTY)
    @ Pkg.Operations C:\Users\michele.zaffalon\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Pkg\src\Operations.jl:755
 [10] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}, new_git::Set{Base.UUID}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform)
    @ Pkg.Operations C:\Users\michele.zaffalon\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Pkg\src\Operations.jl:1394
 [11] add
    @ C:\Users\michele.zaffalon\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Pkg\src\Operations.jl:1376 [inlined]
 [12] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform, kwargs::@Kwargs{io::Base.TTY})
    @ Pkg.API C:\Users\michele.zaffalon\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Pkg\src\API.jl:278
 [13] add(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::@Kwargs{})
    @ Pkg.API C:\Users\michele.zaffalon\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Pkg\src\API.jl:159
 [14] add(pkgs::Vector{Pkg.Types.PackageSpec})
    @ Pkg.API C:\Users\michele.zaffalon\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Pkg\src\API.jl:148
 [15] do_cmd!(command::Pkg.REPLMode.Command, repl::REPL.LineEditREPL)
    @ Pkg.REPLMode C:\Users\michele.zaffalon\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Pkg\src\REPLMode\REPLMode.jl:412
 [16] do_cmd(repl::REPL.LineEditREPL, input::String; do_rethrow::Bool)
    @ Pkg.REPLMode C:\Users\michele.zaffalon\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Pkg\src\REPLMode\REPLMode.jl:390
 [17] do_cmd
    @ C:\Users\michele.zaffalon\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Pkg\src\REPLMode\REPLMode.jl:380 [inlined]
 [18] (::Pkg.REPLMode.var"#24#27"{REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::IOBuffer, ok::Bool)
    @ Pkg.REPLMode C:\Users\michele.zaffalon\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Pkg\src\REPLMode\REPLMode.jl:557
 [19] #invokelatest#2
    @ .\essentials.jl:892 [inlined]
 [20] invokelatest
    @ .\essentials.jl:889 [inlined]
 [21] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit C:\Users\michele.zaffalon\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\REPL\src\LineEdit.jl:2656
 [22] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL C:\Users\michele.zaffalon\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\REPL\src\REPL.jl:1312
 [23] (::REPL.var"#62#68"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL C:\Users\michele.zaffalon\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\REPL\src\REPL.jl:386

My versioninfo

Julia Version 1.10.2
Commit bd47eca2c8 (2024-03-01 10:14 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 6 Ă— Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, skylake)
Threads: 1 default, 0 interactive, 1 GC (on 6 virtual cores)

Thank you for reporting this error.

If you try running pkg> add NodeJS again after it fails the first time does it eventually install correctly, or does it return the same error every time?

Thank you for replying.

It fails again with the same error message.

The weird thing is that when I open a file explorer, the temporary directory in the artifacts folder is empty.

Hmm that’s weird. Do you have a directory named “926ad314605433096abebe5aca612ffbee1347b8” in the artifacts folder? This is the folder that is supposed to be created when installing the “nodejs_app” artifact on Windows

You may be having an issue with your anti-virus. Someone else seems to have had a similar problem, and fixed it by using a different anti-virus. Artifact folder could not be made on Windows. · Issue #3822 · JuliaLang/Pkg.jl · GitHub

1 Like

The folder is not present.

I had a similar case with MAT.jl where the antivirus (Cylance) was deleting HDF5 components, but the antivirus notified me of the problem. I asked the administrator to whitelist those files and I had no more problems. In this case the antivirus does not report anything.

In my case (linked issue), I believe the issue was not that the antivirus was trying to block the files, simply that it opened them for scanning which then made them busy preventing the rename/remove. I only suspected it by seeing more resource usage in task manager by the antivirus when running the artifact install…

If you try the Base.rm overload in the issue and it gets you further, that might be a sign that this is the problem…

1 Like

@KnutAM I tried your hacked Base.rm: even increasing the numbers of tries to 10 with 3 sec sleep between retries did not help: the output was

Trying again for "C:\Users\michele.zaffalon\.julia\artifacts\jl_GYt1fo\node.exe"
Trying again for "C:\Users\michele.zaffalon\.julia\artifacts\jl_GYt1fo\node.exe"
Trying again for "C:\Users\michele.zaffalon\.julia\artifacts\jl_GYt1fo\node.exe"
Trying again for "C:\Users\michele.zaffalon\.julia\artifacts\jl_GYt1fo\node.exe"
Failed for "C:\Users\michele.zaffalon\.julia\artifacts\jl_GYt1fo\node.exe"
Base.IOError("stat(\"C:\\\\Users\\\\michele.zaffalon\\\\.julia\\\\artifacts\\\\jl_GYt1fo\\\\node.exe\"): permission denied (EACCES)", -4092)
Trying again for "C:\Users\michele.zaffalon\.julia\artifacts\jl_GYt1fo"
Trying again for "C:\Users\michele.zaffalon\.julia\artifacts\jl_GYt1fo\node.exe"
Trying again for "C:\Users\michele.zaffalon\.julia\artifacts\jl_GYt1fo\node.exe"
Trying again for "C:\Users\michele.zaffalon\.julia\artifacts\jl_GYt1fo\node.exe"
Trying again for "C:\Users\michele.zaffalon\.julia\artifacts\jl_GYt1fo\node.exe"
Trying again for "C:\Users\michele.zaffalon\.julia\artifacts\jl_GYt1fo\node.exe"
Trying again for "C:\Users\michele.zaffalon\.julia\artifacts\jl_GYt1fo\node.exe"
Trying again for "C:\Users\michele.zaffalon\.julia\artifacts\jl_GYt1fo\node.exe"
Trying again for "C:\Users\michele.zaffalon\.julia\artifacts\jl_GYt1fo\node.exe"
  Downloaded artifact: nodejs_app
ERROR: Unable to automatically download/install artifact 'nodejs_app' from sources listed in 'C:\Users\michele.zaffalon\.julia\packages\NodeJS\LntTk\Artifacts.toml'.
Sources attempted:
- https://pkg.julialang.org/artifact/926ad314605433096abebe5aca612ffbee1347b8
    Error: "C:\\Users\\michele.zaffalon\\.julia\\artifacts\\926ad314605433096abebe5aca612ffbee1347b8" could not be made

(I modified the else clause in the try-block to print the exception).
When I saw that 926ad314605433096abebe5aca612ffbee1347b8 could not be made, I removed the whole artifacts directory and retried the normal way. And it worked.