Ubuntu系统下Snap安装的VS Code因低速网络无法下载扩展的解决方法咨询
Hey Mehdi, sorry to hear you're hitting those frustrating XHR timeout errors when trying to install VS Code extensions—network restrictions and slow speeds can be a real pain. Let's walk through a few practical solutions that should help you get your extensions installed successfully:
1. Manually Download & Install Extensions via VSIX Files
This is the most reliable workaround when direct market access is spotty:
- Open VS Code, go to the Extensions panel, find the extension you want, and copy its unique ID (it looks like
publisher.extension-name, e.g.,ms-python.python—you can find this under the extension's name on its details page). - Download the extension's VSIX file (the offline installation package). You can get this by searching for the extension's name plus "VS Code VSIX download", or by using the official marketplace's download option if you can access it briefly.
- Back in VS Code, open the Command Palette with
Ctrl+Shift+P, type Install from VSIX, select the downloaded file, and follow the prompts to install.
2. Configure VS Code to Use a Proxy
If you have access to a reliable proxy server, setting it up in VS Code can bypass network slowdowns:
- Open VS Code Settings with
Ctrl+,(or go to File > Preferences > Settings). - Search for Http: Proxy and enter your proxy server address (e.g.,
http://your-proxy-ip:port). - Search for Http: Proxy Strict SSL and toggle it to
false(this helps if your proxy uses a self-signed certificate). - Restart VS Code and try downloading extensions again.
3. Switch from Snap to APT Installed VS Code
Snap packages sometimes have network isolation quirks that can worsen timeout issues. Try switching to the APT version:
- First uninstall the Snap version:
sudo snap remove code - Add the official VS Code APT repository and install it via:
sudo apt update && sudo apt install code - The APT version often has better network compatibility for extension downloads.
4. Install Extensions via the Terminal
Using VS Code's command-line tool can sometimes handle network retries better than the GUI:
- First, make sure the
codecommand is available in your terminal (it should be if you have VS Code installed correctly). - Copy the extension ID (same as step 1), then run:
code --install-extension <your-extension-id> - If you're using a proxy, set the proxy environment variables first:
export http_proxy=http://your-proxy-ip:port export https_proxy=http://your-proxy-ip:port code --install-extension <your-extension-id>
Hope one of these methods gets you up and running with your extensions! Let me know if you need clarification on any step.
内容的提问来源于stack exchange,提问作者Mehdi

