Reputation: 674
This is my first time installing and using VSCode, and when I tried installing Prettier extension, it let me peek quickly at the extension page before closing it and displaying this notification (Screenshot attached):
Unable to open 'Extension: Prettier - Code formatter': An unknown error occurred. Please consult the log for more details..
VSCode screenshot: Notification at bottom right
It's doing this with all other extensions. Searched for a solution but found nothing applicable. Why is this happening and how to fix it?
Upvotes: 21
Views: 66928
Reputation: 1
Same issue i have faced today. i was unable to install Prettier extension in vs code then i found this .VSIX file that helped me to solve the problem easily. following are the steps.
Upvotes: 0
Reputation: 41
For windows
cd "C:\Users\<user>\Appdata\Local\Programs\Microsoft VS Code"
code.exe --ignore-certificate-errors
Upvotes: 4
Reputation: 422
In my case I was need to disable work VPN to download extension
Upvotes: -1
Reputation: 31
The solution
clear DNS cache using command on Windows cmd: ipconfig /flushdns
change the default DNS servers in your router settings to Google's:
8.8.8.8 , 8.8.4.4 >> for IPv4
2001:4860:4860::8888 , 2001:4860:4860::8844 >> for IPv6
This link will guide you how to change the DNS server in windows and mac: https://www.ionos.com/digitalguide/server/configuration/how-to-change-dns-server/
restart VSCode and try installing extensions.
Upvotes: 3
Reputation: 674
It happens that, this is a problem with the Egyptian ISPs' default DNS servers, which are most probably blocking some of Microsoft servers.
The solution (in case you live in Egypt):
ipconfig /flushdns
command on Windows cmd (For Other OS).Hopefully, everything will work fine by now.
Check this Github issue for more insight.
Upvotes: 36
Reputation: 25
I faced the same problem while adding new extension in vs code. I Recognized the problem within the ISP in Egypt, so I changed the DNS in My router to Google DNS Providers , and it works perfectly
Upvotes: 1
Reputation: 2297
Just install a VPN like betternet or any other VPN software and change the country to the USA or try other countries.
Upvotes: 0
Reputation: 65534
If you're in a corporate network and it's locked down the one last resort is to manually download the VSIX from the website on a domain that will allow it and then copy over the VSIX and install it.
Upvotes: 2
Reputation: 9840
It probably is because of the certificate check.
Below solution works for me in CentOS 7 (Linux).
Step 1. Change the file /usr/share/applications/code.desktop
Open the file /usr/share/applications/code.desktop
,
then modify the Exec value with adding --ignore-certificate-errors
before %F
:
Exec=/usr/share/code/code --unity-launch --ignore-certificate-errors %F
Save the file with typing sudo
in the begining.
Step 2. Close all windows of vs code instances.
Step 3. Back to the terminal, use below command to open VS code:
code --ignore-certificate-errors
Step 4. Click extension button in the left side bar.
Click any extension like "Ruby" by Peng Lv, if the images in the Details
page can be seen successfully, perhaps the issue is solved.
Step 5. Try to continue to install the extensions you need.
Just enjoy! May it be helpful for you.
Upvotes: 8
Reputation: 11
referring to @Seif A. answer
The solution (in case you live in Egypt)
clear DNS cache using command on Windows cmd:
ipconfig /flushdns
change the default DNS servers in your router settings to Google's:
8.8.8.8 , 8.8.4.4 >> for IPv4
2001:4860:4860::8888 , 2001:4860:4860::8844 >> for IPv6
restart VSCode and try installing extensions.
Upvotes: 1
Reputation: 3093
I got this "XHR failed" error in Visual Studio Code.
So I changed my network settings to use Google Public DNS (instructions)
Finally following instructions (by mohamed-mokhtar) solved for me:
Upvotes: 1
Reputation: 548
in ubuntu go to settings -> wifi -> click on gear icon -> IP4 -> dns input and put
8.8.8.8,8.8.4.4
and click apply, to DNS Resolver Cache open terminal and type:-
sudo systemd-resolve --flush-caches
sudo systemctl restart systemd-resolved
restart your device
Upvotes: 4