visual-studio-codewindows-subsystem-for-linux

VS Code Reports Cookies Module Is Missing


I have been using VS Code for years on WSL. This morning it opened with an error:

[2025-05-09 13:27:45.313] Extension version: 0.99.0
[2025-05-09 13:27:45.313] L10N bundle: none
[2025-05-09 13:27:45.318] authorityHierarchy: wsl+ubuntu
[2025-05-09 13:27:45.318] WSL extension activating for a local WSL instance
[2025-05-09 13:27:45.323] Resolving wsl+ubuntu, resolveAttempt: 1
[2025-05-09 13:27:45.323] WSL feature installed: true (dll path)
[2025-05-09 13:27:45.324] NodeExecServer run: C:\WINDOWS\System32\wsl.exe --list --verbose
[2025-05-09 13:27:45.329] Download in background is enabled
[2025-05-09 13:27:45.357] 1 distros found
[2025-05-09 13:27:45.357] Starting VS Code Server inside WSL (wsl2)
[2025-05-09 13:27:45.357] Windows build: 19045. Multi distro support: available. WSL path support: enabled
[2025-05-09 13:27:45.357] Scriptless setup: false
[2025-05-09 13:27:45.358] No shell environment set or found for current distro.
[2025-05-09 13:27:45.429] WSL daemon log file: 
[2025-05-09 13:27:45.430] Probing if server is already installed: if [ -d ~/.vscode-server/bin/19e0f9e681ecb8e5c09d8784acaa601316ca4571 ]; then printf 'install-found '; fi; if [ -f /etc/alpine-release ]; then printf 'alpine-'; fi; uname -m;
[2025-05-09 13:27:45.430] NodeExecServer run: C:\WINDOWS\System32\wsl.exe -d Ubuntu -e sh -c if [ -d ~/.vscode-server/bin/19e0f9e681ecb8e5c09d8784acaa601316ca4571 ]; then printf 'install-found '; fi; if [ -f /etc/alpine-release ]; then printf 'alpine-'; fi; uname -m;
[2025-05-09 13:27:45.502] Probing result: install-found x86_64
[2025-05-09 13:27:45.502] Server install found in WSL
[2025-05-09 13:27:45.503] NodeExecServer run: C:\WINDOWS\System32\wsl.exe -d Ubuntu sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" 19e0f9e681ecb8e5c09d8784acaa601316ca4571 stable code-server .vscode-server --host=127.0.0.1 --port=0 --connection-token=3564623755-3300462107-3786574462-564283591 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --disable-telemetry --telemetry-level=off'
[2025-05-09 13:27:45.662] Setting up server environment: Looking for /home/mslinn/.vscode-server/server-env-setup. Not found.
[2025-05-09 13:27:45.662] WSL version: 5.15.146.1-microsoft-standard-WSL2 Ubuntu
[2025-05-09 13:27:45.662] WSL-shell-PID: 9208
[2025-05-09 13:27:45.662] Node executable: /home/mslinn/.vscode-server/bin/19e0f9e681ecb8e5c09d8784acaa601316ca4571/node
[2025-05-09 13:27:45.662] Starting server: /home/mslinn/.vscode-server/bin/19e0f9e681ecb8e5c09d8784acaa601316ca4571/bin/code-server --host=127.0.0.1 --port=0 --connection-token=3564623755-3300462107-3786574462-564283591 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --disable-telemetry --telemetry-level=off
[2025-05-09 13:27:45.663] node:internal/modules/esm/resolve:873
[2025-05-09 13:27:45.663]   throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
[2025-05-09 13:27:45.663]         ^
[2025-05-09 13:27:45.663] 
[2025-05-09 13:27:45.663] Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'cookie' imported from /home/mslinn/.vscode-server/bin/19e0f9e681ecb8e5c09d8784acaa601316ca4571/out/server-main.js
[2025-05-09 13:27:45.663]     at packageResolve (node:internal/modules/esm/resolve:873:9)
[2025-05-09 13:27:45.663]     at moduleResolve (node:internal/modules/esm/resolve:946:18)
[2025-05-09 13:27:45.663]     at defaultResolve (node:internal/modules/esm/resolve:1188:11)
[2025-05-09 13:27:45.663]     at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:642:12)
[2025-05-09 13:27:45.663]     at #cachedDefaultResolve (node:internal/modules/esm/loader:591:25)
[2025-05-09 13:27:45.663]     at ModuleLoader.resolve (node:internal/modules/esm/loader:574:38)
[2025-05-09 13:27:45.663]     at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:236:38)
[2025-05-09 13:27:45.663]     at ModuleJob._link (node:internal/modules/esm/module_job:130:49) {
[2025-05-09 13:27:45.663]   code: 'ERR_MODULE_NOT_FOUND'
[2025-05-09 13:27:45.663] }
[2025-05-09 13:27:45.663] 
[2025-05-09 13:27:45.663] Node.js v20.19.0
[2025-05-09 13:27:45.663] For help with startup problems, go to https://code.visualstudio.com/docs/remote/troubleshooting#_wsl-tips
[2025-05-09 13:27:45.664] NodeExecServer run: C:\WINDOWS\System32\wsl.exe -d Ubuntu -e kill 9208

The source of the error seems to be: Cannot find package 'cookie'. No idea why this should occur.

The editor no longer works, and the bash prompt from WSL now displays PowerShell.

I tried reinstalling VS Code (on Windows) overtop the previous installation, and I deleted every directory with cache in the name under %AppData%\Code\, but those actions made no difference.

How can I fix this?


Solution

  • This looks like microsoft/vscode-remote-release: WSL - Error: Cannot find module #9864. The workaround that many people there found helpful was to nuke the ~/.vscode-server/bin/ directory and let it get regenerated.