Reputation: 695
I have this message whenever I try to type code .
/mnt/c/Users/jerom/.vscode/extensions/ms-vscode-remote.remote-wsl-0.63.13/scripts/wslCode.sh: 69: /home/jerome/.vscode-server-server/bin/f80445acd5a3dadef24aa209168452a3d97cc326/bin/code: not found
Can someone help me please?
Thanks in advance
Upvotes: 22
Views: 82208
Reputation: 156
I had the problem after updating to VSCode 1.90.0. The message was rather specific about this file:
/home/<my-user>/.vscode-server/bin/<id>/node: not found
And that file was actually missing (pretty sure, I didn't remove it myself):
$ ls /home/<my-user>/.vscode-server/bin/<id>/node
ls: cannot access (..)
After doing some of the proposed fixes above (like wsl --update
), I removed the .vscode-server
folder:
$ mv ~/.vscode-server ~/_.vscode-server.old
On the next "Connect to WSL" from VSCode on the Windows side, it said "Installing server.." and brought back the required files.
Upvotes: 2
Reputation: 590
I just reinstalled VS code and then went to WSL ubuntu shell and typed code . . It started working
Upvotes: 0
Reputation: 69
Case sensitivity matters as well. I had to use Code.exe . after adding the folder to $PATH.
Upvotes: 0
Reputation: 1020
Simply: It's the same command code .
from your desired directory.
Note: You must need to install wsl
extension in your VS Code
Upvotes: 0
Reputation: 1
I was using the Mamba package manager, and VSCode was in the path, but it didn't work. After I uninstalled mamba, it worked. I'm not sure why.
Upvotes: 0
Reputation: 1
Tried a bunch of stuff. I believe I lost myself trying to fix some packages. I tried
rm -rf ~/.vscode-server/
wsl --shutdown
Reinstalling my WSL plugin on VSCode. What really made it to get back working for me was
wsl --update
In my case, the WSL connection was effective, but no code command inside bash. The error was
run-detectors: unable to find an interpreter for /mnt/c/Users/myuser/AppData/Local/Programs/Microsoft VS Code/Code.exe
Upvotes: 0
Reputation: 21
What worked for me was:
rm -rf ~/.vscode-server/data
Upvotes: 2
Reputation: 49
For who are using Insiders version (and have uninstalled stable version), you should use command code-insiders .
instead code .
If you wish to use just code .
, go to the win folder:
\Users\:userprofile\AppData\Local\Programs\Microsoft VS Code Insiders\bin
and clone the file code-insiders
, renaiming to code
Upvotes: 0
Reputation: 1
you just need to add .bashrc file with: export PATH=$PATH:"/mnt/c/Users//AppData/Local/Programs/Microsoft VS Code/bin"
Upvotes: 0
Reputation: 44307
I found another solution.
On my machine, Visual Studio Code had been installed by an Admin for all users, and I found that not only was code .
not available within my WSL environment, but commands like Dev Container: Reopen in Container
failed to work as well.
Installing a private copy of Visual Studio Code (which is the normal default), made everything work.
$ which code
/mnt/c/Users/bearps/AppData/Local/Programs/Microsoft VS Code/bin/code
To check your situation, open a PowerShell prompt and run
PS> get-command code
CommandType Name Version Source
----------- ---- ------- ------
Application code.cmd 0.0.0.0 C:\Users\bearps\AppData\Local\Programs\Microso...
If the location shown is under C:\Program Files
or C:\Program Files (x86)
try switching to a local install.
Upvotes: 0
Reputation:
Go to VS code on Windows, extensions -> WSL, install it. Then restart the WSL subsystem and will work.
Upvotes: 0
Reputation: 613
Try these 5 simple steps:
wsl --shutdown
code
command, typing on PowerShell the following command wsl ~ -u MyUser
code .
on the batch terminal or specify the whole path code ./myapps/hello-world-app
Upvotes: 2
Reputation: 324
I just ran into this issue after setting up WSL and vscode on a new computer.
The solution that worked for me was to sign out of windows. Once I logged back in the PATH env variable seemed correct and launching vscode from WSL worked as expected.
Upvotes: 0
Reputation: 9866
For me it was wsl using the wrong container:
wsl --list -v
NAME STATE VERSION
* docker-desktop-data Stopped 2
Ubuntu Running 2
I did wsl -s ubuntu
wsl --list -v
NAME STATE VERSION
* Ubuntu Running 2
docker-desktop-data Stopped 2
and it solved the problem
Upvotes: 1
Reputation: 129
I solved this problem by opening windows powershell in admin mode and typing the following command:
wsl --update
Then I typed this command to force restart the WSL and all done
wsl --shutdown
Upvotes: 13
Reputation: 647
I just now had the same issue on WSL2 Kali. I tried everything given here: https://github.com/microsoft/vscode-remote-release/issues/2962.
My problem was VS Code was not on Kali's path. Here's how I fixed it :)
echo $PATH
# Confirm PATH is missing this:
/mnt/c/Users/wcd/AppData/Local/Programs/Microsoft VS Code/bin/
# Confirm VS Code's location then export:
export PATH=$PATH:"/mnt/c/Users/wcd/AppData/Local/Programs/Microsoft VS Code/bin/"
# It's temporarily added to path...
echo $PATH
# This should now trigger VS Code Server install,
# then open ~/ in VS Code.
code .
# If above works, make it permanent:
echo 'export PATH=$PATH:"/mnt/c/Users/wcd/AppData/Local/Programs/Microsoft VS Code/bin/"' >> ~/.bashrc
# Restart shell + test
exec "$SHELL"
code .
Upvotes: 39
Reputation: 695
Fixed it
Open VS Code on Windows
Open Extensions and then search on WSL
It should say the extension needs to be reloaded - go ahead and reload it
This should force another upgrade of code and this time it should launch.
Upvotes: 25
Reputation: 121
This also happens if you disable the Windows PATH on WSL. I had my VS Code working fine, then when I disable the windows PATH (by editing/creating the /etc/wsl.conf
file and inserting the [interop] appendWindowsPath = false
parameter) the code
command stopped working.
The ek1n8 solution solves my problem, addind the export manually to the WSL Path:
export PATH=$PATH:"/mnt/c/Users/%USERNAME%/AppData/Local/Programs/Microsoft VS Code/bin"
Upvotes: 12
Reputation: 1002
For me adding the binary to Path was enough:
export PATH=$PATH:"/mnt/c/Users/%USERNAME%/AppData/Local/Programs/Microsoft VS Code/bin"
Upvotes: 4
Reputation: 101
I have same issue when I trying export my old wsl and move whole project to nvme ssd using new distro.
I able to run the code .
on root , but when i switch to my name then it doesn't work, I guess is WSL PATH problem.
I not really familiar to the linux, the below image may easier for you to understand what i am saying.
When i use echo $PATH
on wsl to compare root and my account, and i notice that VS code directory only found on root instead of my account.
So i use export PATH=$PATH:"/mnt/c/Users/ricso/AppData/Local/Programs/Microsoft VS Code/bin"
to add the VS Code path to my account* and code .
is working once i export this.
But the code .
will not be able to run again if you restart the wsl, so we need to put in to bashrc.
But when i try to update my account's* PATH using
echo "PATH=$PATH:/mnt/c/Users/ricso/AppData/Local/Programs/Microsoft\ VS\ Code/bin" >> ~/.bashrc
and restart the wsl to login my account, i notice an error msg popup when run the code .
cannot create /tmp/remote-wsl-loc.txt: Permission denied
And i found this. https://github.com/microsoft/vscode-remote-release/issues/5389
Seem they only giving the workaround for now and hopefully can fix it soon.
*disclaimer above: this code need to run under your account instead of root
**For editing bashrc, instead of using echo and >> write to the file, you also can use code ~/.bashrc
to update/edit, when you have the vscode access on wsl.
Upvotes: 5