jetify-com / devbox

Instant, easy, and predictable development environments
https://www.jetify.com/devbox/
Apache License 2.0
8.28k stars 192 forks source link

[Bug]: Unable to run devbox shell #1661

Open PerttyZhan opened 9 months ago

PerttyZhan commented 9 months ago

Current Behavior (bug) Run devbox shell is failing, wating for long time, finally report an error

Expected Behavior (fix) Run devbox shell success

Additional context devbox version -v

Version:     0.8.2
Platform:    darwin_arm64
Commit:      33ea788cb4dbf6958208669c9e4df9c1e858ad2c
Commit Time: 2023-11-15T00:23:52Z
Go Version:  go1.21.3
Launcher:    0.2.0

devbox.json`

{
  "packages": [
    "nodejs@latest",
    "yarn@latest"
  ],
  "shell": {
    "init_hook": [
      "echo 'Welcome to devbox!' > /dev/null"
    ],
    "scripts": {
      "test": [
        "echo \"Error: no test specified\" && exit 1"
      ]
    }
  }
}
PerttyZhan commented 9 months ago

Run devbox shell error:

Error: Command: /nix/var/nix/profiles/default/bin/nix print-dev-env /Users/zhanheng/workspace/my/wzjxbz-master/.devbox/gen/flake --extra-experimental-features ca-derivations --option experimental-features nix-command flakes fetch-closure --json: exit status 1
savil commented 9 months ago

@PerttyZhan could you do export DEVBOX_DEBUG=1, re-run devbox shell, and then share the output please?

PerttyZhan commented 9 months ago

@PerttyZhan could you do export DEVBOX_DEBUG=1, re-run devbox shell, and then share the output please?

thank. when i run again, It actually worked but when i download new package, it worked Fail frequently

PerttyZhan commented 9 months ago

run devbox add vim@8.2.345 expect success but download fail

2023/12/05 09:12:14 findProjectDir: path is 
2023/12/05 09:12:14 finding devbox.json in dir: /Users/zhanheng/workspace/my/wzjxbz-master
2023/12/05 09:12:14 findProjectDir: path is 
2023/12/05 09:12:14 finding devbox.json in dir: /Users/zhanheng/workspace/my/wzjxbz-master
2023/12/05 09:12:14 findProjectDir: path is 
2023/12/05 09:12:14 finding devbox.json in dir: /Users/zhanheng/workspace/my/wzjxbz-master
Info: Adding package "vim@8.2.3451" to devbox.json

Installing package: vim@8.2.3451.

[1/1] vim@8.2.3451
2023/12/05 09:12:22 running command: /nix/var/nix/profiles/default/bin/nix profile install --profile /Users/zhanheng/workspace/my/wzjxbz-master/.devbox/nix/profile/default --impure --priority 9 /nix/store/kck9cmbg0z35vv7vz1vdz02003cs6092-vim-8.2.3451 --extra-experimental-features ca-derivations --option experimental-features nix-command flakes fetch-closure
warning: error: unable to download 'https://cache.nixos.org/kck9cmbg0z35vv7vz1vdz02003cs6092.narinfo': Timeout was reached (28); retrying in 255 ms
querying vim-8.2.3451 on https://cache.nixos.org
Lagoja commented 9 months ago

This looks like maybe a network issue trying to download from the cache, but I'll try to reproduce and see if it's something else.

Lagoja commented 9 months ago

That vim package installed ok for me, so I think it's probably a network issue. We should tweak the error message to explain when this is the case, so that it's clearer what's happening.

savil commented 9 months ago

@PerttyZhan thanks for sharing that. For clarity:

  1. Are all the errors you are seeing having to do with downloading the .narinfo from the nix cache? Or are there other kinds of errors as well?
  2. Does this error block you? My understanding is that the devbox shell should still start up (but may be slower since it cannot use the cache), but I could be wrong.
  3. If you are comfortable, could you describe your network connection situation? (example: its known to be weak, or writing code on a train or bus, etc.) ?