Frustrated Developer

How to Fix Visual Studio Code Crashes on Ubuntu

Do you need a learn WordPress? Learn by doing now!

Sharing is caring!

As a developer, dealing with an IDE that crashes on startup is incredibly frustrating. Visual Studio Code (VS Code) is a popular choice, so when it fails to work, productivity can take a hit. Recently, I encountered this issue on Ubuntu, and here’s how I resolved it.

The Problem

When launching Visual Studio Code, it would load the project and then immediately close. This unexpected behavior was particularly annoying, and it seemed surprising that such a critical issue slipped through Microsoft’s quality control.

What Caused the Crash?

The problem started after I disabled hardware acceleration in the $HOME/.vscode/argv.json file. I made this change because VS Code was running extremely slow on my Ubuntu setup, which I suspected was due to Nvidia drivers.

Here’s how to get some info about your graphic card

hwinfo --gfxcard --short

graphics card:                                                  
                       nVidia GP108M [GeForce MX150]
                       Intel UHD Graphics 620

Primary display adapter: #24

How to Check Your Video Card Drivers

This may have been caused by nvidia drivers. Not sure and didn’t have time to fully troubleshoot.
Before diving into fixes, ensure that your Nvidia drivers are up to date. Run the following command in your terminal (as root):

ubuntu-drivers autoinstall

The solution to prevent VS Code from crashing

I uninstalled it and reinstalled it and then found this parameter that fixed the issue and code doesn’t crash anymore. Maybe the reinstallation wasn’t necessary but I found about it after I uninstalled it.

code --in-process-gpu .

It will produce a warning: Warning: ‘in-process-gpu’ is not in the list of known options, but still passed to Electron/Chromium. but it will start.

Links

these are the links I checked during the troubleshooting.

Sharing is caring!

Do you need a learn WordPress? Learn by doing now!
This code shared in this post/site is provided "AS IS" without any warranties or guarantees of any kind. The authors and distributors of this code cannot be held responsible for any damage, data loss, or other issues that may arise from its use. It is strongly recommended that you test this code in a staging environment before deploying it to a live site. Always ensure you have proper backups and understand the implications of running this code on your WordPress installation. Use at your own risk.

Leave a Comment

Your email address will not be published. Required fields are marked *