VS Code安装‘C/C++’扩展报错,下载所有扩展均失败,重装后问题仍存在如何解决?
Hey there, sorry to hear you're stuck with this frustrating extension installation issue in VS Code—especially since reinstalling the app didn’t fix it. Let’s walk through some targeted fixes that usually resolve this kind of widespread problem:
1. Fully Clean VS Code's Cache & User Data
A standard reinstall often leaves behind corrupted cache files or misconfigured user data that’s still causing issues. Let’s wipe those completely to start fresh:
- Windows:
- Close VS Code completely (check task manager to make sure no background processes are running).
- Delete these two folders:
%APPDATA%\Code(stores your settings, installed extensions, and cached data)%USERPROFILE%\.vscode(another common location for extensions and cache)
- macOS:
- Quit VS Code fully.
- Delete these folders via Finder or terminal:
~/Library/Application Support/Code~/.vscode
- Linux:
- Close all VS Code windows.
- Delete these directories in terminal:
~/.config/Code~/.vscode
- After deleting these, reinstall VS Code from scratch.
2. Troubleshoot Network & Proxy Issues
Most widespread extension install failures trace back to network restrictions. Let’s rule these out:
- Temporarily Disable Proxy/VPN: If you’re using a system proxy or VPN, turn it off and try installing an extension again. Proxies often block VS Code’s connection to the extension marketplace.
- Adjust VS Code’s Network Settings:
- Open VS Code, go to
File > Preferences > Settings(or pressCtrl+,/Cmd+,). - Search for
http.proxy—make sure no incorrect proxy URLs are set. If you need a proxy, double-check the address and port are accurate. - Try toggling
http.proxyStrictSSLtofalsetemporarily (note: this reduces security, so revert it if the fix works).
- Open VS Code, go to
- Check Firewall/Antivirus: Your system firewall or antivirus might be blocking VS Code from accessing the internet. Add VS Code to your allowed apps list, or temporarily disable the antivirus to test (remember to re-enable it afterward).
3. Manually Install Extensions
If the marketplace is unreachable, bypass it with manual installation:
- Open the official VS Code Extension Marketplace website in your browser.
- Search for the extension you want, download the
.vsixfile (look for the "Download Extension" option under the "Resources" section on the extension’s page). - In VS Code, open the Extensions panel (
Ctrl+Shift+X/Cmd+Shift+X), click the three dots (...) in the top-right corner, selectInstall from VSIX..., and pick the downloaded file.
4. Fix File Permission Issues
VS Code might not have permission to write to its installation or extension folders:
- Windows: Right-click the VS Code shortcut, select
Run as administrator, then try installing an extension. - macOS/Linux: Ensure the
.vscodefolder has the correct permissions. Run this command in terminal:
This sets your user account as the owner of the folder, fixing write-access blockages.chown -R $USER:$USER ~/.vscode
5. Reset VS Code to Default Settings
Corrupted user settings could be the culprit:
- Open VS Code, press
Ctrl+Shift+P/Cmd+Shift+Pto open the command palette. - Search for
Preferences: Reset Settingsand select it. Confirm the reset when prompted—this won’t delete your extensions, but will revert all settings to default.
6. Test with the Portable Version
If all else fails, the portable version can help rule out system-wide issues:
- Download the portable version of VS Code from the official website (look for the "Portable" option for your OS).
- Extract it to a folder, run the executable, and try installing an extension. If it works, the problem is tied to your main installation’s configuration or system-level permissions.
内容的提问来源于stack exchange,提问作者Krity Haque Charu

