VS Code error Enoent: no such directory, lstat'/snap/code' - visual-studio-code

I got an error when launch VS Code, I tried to to stop every extension to check if error fill gone.. but not. It's Ubuntu machine
Error message

I have the same issue. It concerns users using VSCode with snap on Ubunutu.
VSCode is looking in the wrong directory.
The problem was reported here : github.com/Microsoft/vscode

As mentioned here, the problem may be fixed temporarily by running:
sudo ln -s /snap/vscode /snap/code

Related

VS Code not starting on WSL

Yesterday when I tried to open my VS Code then WSL started updating after the update, I started getting errors and after that, I am not able to start VS Code.
Errors
/mnt/c/Users/dell/.vscode/extensions/ms-vscode-remote.remote-wsl-0.72.0/scripts/wslCode.sh: 50: /home/rahulrajput83/.vscode-server-server/bin/d045a5eda657f4d7b676dedbfa7aab8207f8a075/bin/code: not found
What I have tried
I have searched for the error on google and found some solutions here https://github.com/microsoft/vscode-remote-release/issues/6294
I have tried the solutions available on above link but problem is not fixed.
I have used these commands sudo apt update wsl.exe --shutdown
Please help me to solve this error.

cannot connect to the remote wsl on vs code (Error: [UriError]: cannot call joinPath on URI without path)

i'm trying to use wsl on vs code. it worked well until it unexpectedly stopped working.
Any ideas on how can i fix this? I tried to uninstall and reinstall vs code as well as stopping the remote server but it did not work either. I'm still stuck on the workspace page without the possibility to do anything.
Thanks in advance.
Uninstalling doesn't affect the vscode server files in your home directory. Removing said files will cause a fresh install of said server and remote container files. So,
rm -r ~/.vscode*
code <wherever_you_like>

VSCodium terminal error message => error layer=debugger can't find build-id note on binary?

I have VSCodium v1.64.2 and have this error message in my integrated terminal window upon "Run/Start Debugging" command:
2022-02-14T17:14:16-06:00 error layer=debugger can't find build-id note on binary
This error message appears on all my programs inside the terminal window. I'm learning Golang (GO) and am new to the VSCodium (VSCode community) editor. My program runs fine with no errors in my Ubuntu terminal window as well as the integrated terminal in VSCodium.
Is there something I can do to correct the error? It's not interfering with my work, but I was curious. Thanks.
According to the issue of go-delve / delve (
#latestas delve#1.8.2of 2022/02/13), this problem is not addressed, so
install delve manually instead of installing with VS Code extension etc
# Install at tree head:
$ go install github.com/go-delve/delve/cmd/dlv#master
or
$ git clone https://github.com/go-delve/delve
$ cd delve
$ go install github.com/go-delve/delve/cmd/dlv
According to https://github.com/go-delve/delve/pull/2893, which has been merged, it should now just be a warning. You likely pulled delve before the merge, though, so updating should fix this.

Recipe terminated with fatal error: spawn latexmk ENOENT

I have just installed debian 10 as well as vscode. I have been struggling with this for 3 days now.. I installed texlive from terminal with the following command:
sudo apt install texlive
I then installed the latex workshop extension in vscode and tried building a .tex file. The following error popped up:
Recipe terminated with fatal error: spawn latexmk ENOENT.
I then preceded to install latexmk from terminal with:
sudo apt install latexmk
The same error kept popping up after that. The output showed this.
[14:59:34] Recipe step env: {}
[14:59:34] cwd: /home/phoenix/Documents/stellies/year4/2021/s&s-414/pracs/prac-4/report
[14:59:34] LaTeX build process spawned. PID: undefined.
[14:59:35] LaTeX fatal error: spawn latexmk ENOENT, . PID: undefined.
[14:59:35] Does the executable exist? PATH: /app/bin:/usr/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/node/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/cargo/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/python/bin
[14:59:35] The environment variable $SHELL: /bin/sh
I then proceded to review the texlive website. I noticed that i did not set the path variable to include the texlive binaries. The texlive website gives the following path to the binary files : PATH=/usr/local/texlive/2021/bin/x86_64-linux:$PATH
however /usr/local/texlive does not exist on my system for some reason. Where can i find the correct path to the texlive binaries on Debian 10?
I had the same problem. The root cause was: (1) software's bin folder missing from PATH; (2) bad file privileges. Consequently, VSC couldn't access latexmk, which explains the error messages.
In my case, the problem occurred on a mac, and specifically after I installed MacTex, which, in turn, installs Tex Live. I believe the same solution may apply to linux distros too.
Solution:
Claim file ownership (which was originally root) under folder /usr/local/texlive: sudo chown -R <username> /usr/local/texlive, where <username> is the OS-level user name. The fix will work for this specific user. If it is not enough, try instead setting group owner appropriately, and/or consider Step 3.
Add /usr/local/texlive/2021/bin/<software_dialect> to PATH. <software_dialect> depends on the installed software version: in my case it is universal-darwin; on linux it might be x86_64-linux.
If the problem persists, try to change file access permissions under /usr/local/texlive using chmod.
EDIT: As a final step, restart VSC for changes to take effect.
I recently encountered the same problem on MacOS Monterrey (M1 based). I used basictex (just for the context). As required by the installation instruction,
I added TeXLive to PATH,
installed latexmk package to the TeX distribution.
However, still got the same error as OP.
Afte reading the wiki again more carefully, what finally worked for me was as simple as restarting VS Code and MacOS. Everything works as expected after a reboot of the MAC.
I had this same problem on Mac recently, the fix that worked for me was to uninstall and reinstall the LaTeX Workshop extension.
I got the same issue , seems to be a misbehaving from Vscode on MacOS
check if the command is in the path on mac
-which command_you are running example which latexmk
If this output something that means you have your latex installed, otherwise go and installed it and make sure it is accessible via command line.
If latex is installed and you are getting that issue you can just restart your VSCode and everything will be okay.
Had a similar error and came across this post when looking for a solution.
I wanted to use texlive on Vscode with WSL2 on Windows 10. Installing texlive-full in wsl fixed this error for me.
On Mac, this is a way to fix the issue
Step1: reinstall mactex by downloading it from this link: http://www.tug.org/mactex/mactex-download.html
Step2: In your terminal do cd /usr/local, you should see texlive folder
Step3: In your terminal do sudo vim etc/paths to set the environment. Details are in this link: https://www.architectryan.com/2012/10/02/add-to-the-path-on-mac-os-x-mountain-lion/
Step4: In your terminal do /usr/local/texlive/2021/bin/x86_64-linux at the bottom. check the folder to see if the year is correct. Details in: http://www.tug.org/texlive/quickinstall.html.
Step5: Quit VC code completely, and reopen it.

Visual Studio Code - PHPCS error (Unknown error ocurred. Please verify that returns a valid json object)

I am trying to set up the PHPCS plugin, but so far I am only getting this error:
phpcs: Unknown error ocurred. Please verify that /home/[user]/Documents/offprojects/vet_direct/vetsdirectapp/vendor/bin/phpcs --report=json -q --encoding=UTF-8 --error-severity=5 --warning-severity=5 --stdin-path=/home/[user]/Documents/offprojects/vet_direct/vetsdirectapp/app/Http/Controllers/JobController.php - returns a valid json object.
I followed the installation guide from the plugin page and installed PHPCS both globally and in the project. Also, the command in terminal shows this error:
zsh: command not found: phpcs
Any idea what is wrong here?
This might not help you, but for me, the executable path wasn't correct and the version of PHPCS didn't support PHP 7, it was still using PHP 5.
I'm going to assume you're on Linux based OS.
Since you have already installed PHPCS globally, access the phpcs file. This should be somewhere like ~/.config/composer/vendor/squizlabs/php_codesniffer/bin if you're on Debian based Linux OS (like Ubuntu Focal Fossa 20.04LTS). But it might differ depending on versions.
If you use a text editor to peek the phpcs file inside it (this will be the same on your Executable Path), it might say PHP 5, that's how I found I needed to upgrade mine.
To upgrade your PHPCS do composer global require "squizlabs/php_codesniffer=*" this might fix your issue. After that, you might need to fix your Executable Path again, I had to do mine.
To edit the executable path on Visual Studio Code Command + , (or go to settings) then search for PHP CodeSniffer. Go down to Executable Path and make sure it's correct.
This might not work, but it's worth a try.
After trying a lof of different things, this is what worked for me. I'm on a Mac and using Zsh.
First, installed PHP Code Sniffer (phpcs) with Composer, as Hugo suggested on the answer above:
composer global require "squizlabs/php_codesniffer=*"
But then, I had to edit my .zshrc and added this line:
export PATH=/Users/YOURUSER/.composer/vendor/bin:$PATH
After that, close the Terminal and I was able to run phpcs -h
In my case an error was being thrown by various processes "Could not load xdebug because it is already loaded". This did not show in VSCode, but did if I ran php -v or php --ini.
This is what cleared the error for me:
Edit the /etc/php/8.0/apache2/conf.d/xdebug.ini file and comment out the line zend_extension=xdebug.so. Restart apache with sudo systemctl restart apache2, then try php -v. The "Could not load xdebug because it is already loaded" error should be gone. Restart VSCode and this phpcs error should stop showing.
I have VSCode configured to debug php and have the xdebug configuration settings in both the etc/php/php8.0/apache2/php.ini and etc/php/php/8.0/cli/php.ini files.
How I discovered this is I downloaded the source code and searched for where that error was being thrown. What I found was that ANY error in stderr outside of a very narrow range gets this error message. I had noticed this error showing in my terminal, and I researched how to clear it. When I did, the VSCode phpcs error went away!
On Windows:
Open the XAMPP Control Panel.
Apache -> Config -> php.ini
Search for zend_extension=xdebug.so or something the like and delete it.
Restart Apache.
Try again.
In my case, It was happening due to XDebug and resolved after disabling xdebug from Xampp.
Goto C:\xampp\php\php.ini
find and disable (add ;) before following lines
Change :
xdebug.mode=debug
xdebug.start_with_request=yes
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
to :
;xdebug.mode=debug
;xdebug.start_with_request=yes
;zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
Restart Apache and then vscode. It should fix that.