Dfx freezes when trying to do anything

installed dfx 0.15.1 on my wsl2 on my new computer, ran
“dfx new hello_world”
“cd hello_world”
“dfx start --background”
“dfx deploy”
deployed, backend canister candid interface works but not front-end, throws error idon’t remember.
did this sequence more than once, but now whenever im either trying to deploy or install canisters console freezes and after a while it throws a time out error

Deploying all canisters.
All canisters have already been created.
Building canisters...
Installing canisters...
Upgrading code for canister hello_world_backend, with canister ID bkyz2-fmaaa-aaaaa-qaaaq-cai
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
  Failed while trying to install all canisters.
    Failed to install wasm module to canister 'hello_world_backend'.
      Failed during wasm installation call: The request timed out.

that’s an example while trying to deploy

1 Like

Sounds like it could be a WSL issue… To debug, can you please put this in your dfx.json and see if you notice any errors in the replica’s output? It probably helps to run the replica in a different terminal

  "defaults": {
    "replica": {
      "log_level": "info"
    }
  },
  "networks": {
    "local": {
      "bind": "127.0.0.1:4943"
    }
  },

1 Like

now i’m running dfx in a separate terminal

dfx deploy
Deploying all canisters.
All canisters have already been created.
Building canisters...
Installing canisters...
Module hash e0b9b2e0ad7ac4eb5a53bb5c75df4183263fc7070594362aa8ed3c3210f6421e is already installed.
Module hash baf9bcab2ebc2883f850b965af658e66725087933df012ebd35c03929c39efe3 is already installed.
Uploading assets to asset canister...
Fetching properties for all assets in the canister.
Starting batch.
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
  Failed while trying to install all canisters.
    Failed to install wasm module to canister 'hello_world_frontend'.
      Failed to store assets in canister 'hello_world_frontend'.
        Failed asset sync with canister bd3sg-teaaa-aaaaa-qaaba-cai.
          Failed to create batch: The request timed out.

this is the dfx.json file

{
  "canisters": {
    "hello_world_backend": {
      "main": "src/hello_world_backend/main.mo",
      "type": "motoko"
    },
    "hello_world_frontend": {
      "dependencies": [
        "hello_world_backend"
      ],
      "source": [
        "src/hello_world_frontend/assets"
      ],
      "type": "assets"
    }
  },
    "defaults": {
    "replica": {
      "log_level": "info"
    }
  },
  "networks": {
    "local": {
      "bind": "127.0.0.1:4943"
    }
  },
  "output_env_file": ".env",
  "version": 1
}

And do you get any interesting outputs from the dfx start terminal?

no
so i just reinstalled wsl and now it’s again working, backend canister candid interface working just fine but front-end says “not found”, however i noticed that when i do “npm install” i get an error, how important is this step?

this is the error

npm install
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path \\wsl.localhost\Ubuntu\home\ivo\hello_world/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open '\\wsl.localhost\Ubuntu\home\ivo\hello_world\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in: C:\Users\ivocm\AppData\Local\npm-cache\_logs\2023-11-13T13_19_49_869Z-debug-0.log

this is the “complete log”

0 verbose cli C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
1 info using npm@10.1.0
2 info using node@v20.9.0
3 timing npm:load:whichnode Completed in 3ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 4ms
6 timing config:load:builtin Completed in 4ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:\\wsl.localhost\Ubuntu\home\ivo\hello_world\.npmrc Completed in 0ms
10 timing config:load:project Completed in 7ms
11 timing config:load:file:C:\Users\ivocm\.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:C:\Users\ivocm\AppData\Roaming\npm\etc\npmrc Completed in 1ms
14 timing config:load:global Completed in 1ms
15 timing config:load:setEnvs Completed in 1ms
16 timing config:load Completed in 18ms
17 timing npm:load:configload Completed in 18ms
18 timing config:load:flatten Completed in 1ms
19 timing npm:load:mkdirpcache Completed in 1ms
20 timing npm:load:mkdirplogs Completed in 0ms
21 verbose title npm install
22 verbose argv "install"
23 timing npm:load:setTitle Completed in 1ms
24 timing npm:load:display Completed in 1ms
25 verbose logfile logs-max:10 dir:C:\Users\ivocm\AppData\Local\npm-cache\_logs\2023-11-13T13_19_49_869Z-
26 verbose logfile C:\Users\ivocm\AppData\Local\npm-cache\_logs\2023-11-13T13_19_49_869Z-debug-0.log
27 timing npm:load:logFile Completed in 10ms
28 timing npm:load:timers Completed in 0ms
29 timing npm:load:configScope Completed in 0ms
30 timing npm:load Completed in 67ms
31 timing config:load:flatten Completed in 1ms
32 timing arborist:ctor Completed in 0ms
33 timing arborist:ctor Completed in 1ms
34 silly logfile start cleaning logs, removing 3 files
35 timing idealTree:init Completed in 14ms
36 timing idealTree:userRequests Completed in 1ms
37 silly idealTree buildDeps
38 timing idealTree:#root Completed in 0ms
39 timing idealTree:buildDeps Completed in 1ms
40 timing idealTree:fixDepFlags Completed in 0ms
41 timing idealTree Completed in 16ms
42 timing reify:loadTrees Completed in 17ms
43 timing reify:diffTrees Completed in 1ms
44 silly reify moves {}
45 timing reify:retireShallow Completed in 1ms
46 timing reify:createSparse Completed in 0ms
47 timing reify:loadBundles Completed in 0ms
48 timing reify:unpack Completed in 0ms
49 timing reify:unretire Completed in 0ms
50 timing build:queue Completed in 0ms
51 timing build:deps Completed in 1ms
52 timing build Completed in 1ms
53 timing reify:build Completed in 1ms
54 timing reify:trash Completed in 0ms
55 silly logfile done cleaning log files
56 timing reify:save Completed in 3ms
57 timing reify Completed in 31ms
58 timing command:install Completed in 35ms
59 verbose stack Error: ENOENT: no such file or directory, open '\\wsl.localhost\Ubuntu\home\ivo\hello_world\package.json'
60 verbose cwd \\wsl.localhost\Ubuntu\home\ivo\hello_world
61 verbose Windows_NT 10.0.22621
62 verbose node v20.9.0
63 verbose npm  v10.1.0
64 error code ENOENT
65 error syscall open
66 error path \\wsl.localhost\Ubuntu\home\ivo\hello_world/package.json
67 error errno -4058
68 error enoent ENOENT: no such file or directory, open '\\wsl.localhost\Ubuntu\home\ivo\hello_world\package.json'
69 error enoent This is related to npm not being able to find a file.
69 error enoent
70 verbose exit -4058
71 timing npm Completed in 469ms
72 verbose code -4058
73 error A complete log of this run can be found in: C:\Users\ivocm\AppData\Local\npm-cache\_logs\2023-11-13T13_19_49_869Z-debug-0.log

Nice! Glad to hear that’s working

If the frontend can’t be built, either because the dependencies can’t be installed or because the build itself fails, then there is no frontend to be uploaded, so I would even expect to get ‘not found’

1 Like

it keeps happening spontaneously btw… i can’t keep reinstalling the WSL every time

Deploying all canisters.
Creating canisters...
Creating canister h_w_r_backend...
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
  Failed while trying to register all canisters.
    Failed to create canister 'h_w_r_backend'.
      The request timed out.

That looks very wrong… But I don’t see how I can reproduce this. Can you maybe try the new 0.15.2-beta.0 of dfx? Maybe the replica included in that works better?