volta-cli / volta

Volta: JS Toolchains as Code. ⚡
https://volta.sh
Other
11.06k stars 232 forks source link

volta install very slow in WSL2/Ubuntu #1914

Open peterjuras opened 1 week ago

peterjuras commented 1 week ago

Hi!

I've been using volta for some time and really enjoy it.

Since some days/weeks, volta install appears to be very slow in my environment. For example the command volta install bun takes 3 minutes. A speedtest before running volta shows that my network should be much faster.

Do you know what the issue could be?

My environment: WSL2 & Ubuntu 22

Logs:


   Speedtest by Ookla

      Server: Server.camp - Kassel (id: 61216)
         ISP: 1&1 Versatel Deutschland GmbH
Idle Latency:    10.78 ms   (jitter: 0.82ms, low: 10.67ms, high: 12.32ms)
    Download:   694.68 Mbps (data used: 843.3 MB)
                 10.79 ms   (jitter: 3.64ms, low: 9.09ms, high: 231.92ms)
      Upload:   858.83 Mbps (data used: 1.0 GB)
                 15.92 ms   (jitter: 5.28ms, low: 10.04ms, high: 341.11ms)
 Packet Loss:     0.0%
  Result URL: https://www.speedtest.net/result/c/073be394-d392-4c32-82d5-4040b0d8efae                                                                                                                                                                                                                                                                                               /26.2s
➜  ~ VOLTA_LOGLEVEL=debug RUST_BACKTRACE=full volta install bun
[verbose] Acquiring lock on Volta directory: /home/juras/.volta/volta.lock
[verbose] Found default configuration at '/home/juras/.volta/tools/user/platform.json'
[verbose] node@20.18.0 has already been fetched, skipping download
[verbose] npm@10.9.0 has already been fetched, skipping download
[verbose] yarn@1.22.22 has already been fetched, skipping download
[verbose] Installing bun with command: PATH="/home/juras/.volta/tools/image/npm/10.9.0/bin:/home/juras/.volta/tools/image/yarn/1.22.22/bin:/home/juras/.volta/tools/image/node/20.18.0/bin:/home/juras/.sdkman/candidates/sbt/current/bin:/home/juras/.sdkman/candidates/java/current/bin:/home/juras/.yarn/bin:/home/juras/.config/yarn/global/node_modules/.bin:/home/juras/.volta/bin:/home/juras/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files/Volta/:/mnt/c/Python311/Scripts/:/mnt/c/Python311/:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files (x86)/GnuPG/bin:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/Program Files/Git/cmd:/mnt/c/Users/pjuras/AppData/Local/Volta/bin:/mnt/c/Users/pjuras/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/pjuras/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/pjuras/AppData/Local/Programs/Espanso:/mnt/c/Users/pjuras/AppData/Local/Microsoft/WinGet/Links:/snap/bin:/opt/datawario/bin" npm_config_prefix="/home/juras/.volta/tmp/image/packages/.tmpQugORx" "npm" "install" "--global" "--loglevel=warn" "--no-update-notifier" "--no-audit" "bun"
[verbose] [install stderr]

[verbose] [install stdout]

added 3 packages in 3m

success: installed bun@1.1.30 with executables: bun, bunx
[verbose] Unlocking Volta Directory
[verbose] No custom hooks found                                                                                                                                                                                                                                                                                                                                                   /3m-8.6s
➜  ~             

image

zenware commented 5 days ago

My best guess is Windows Defender is enabled on the entire WSL filetree, this is a classic reason for things being slow with WSL. There's lots of documentation and resources about how to set up exclusions in reasonable ways.

Here's a community made powershell script I found while googling for a refresher on the issue, you may find it helpful https://gist.github.com/noelbundick/9c804a710eb76e1d6a234b14abf42a52#file-excludewsl-ps1

Unfortunately I don't know of any reasonably easy ways to profile the exact nature of the slowdown, otherwise I'd suggest that instead of grasping at straws