Failed to open browser while using line server in VScode - visual-studio-code

I am getting "Server is started at 5500 but failed to open browser. Try to change the CustomBrowser settings." in VScode while using line server. I have tried to change default settings but i still can't solve it.

In VScode go to extension (ctrl+shift+x) and search for live server, on live server go to manage > extension setting, then look for Live Server > Settings:Use Browser Preview section in the settings.
If the checkbox is checked, uncheck it.

Related

How to make firefox developer edition as default browser for development [duplicate]

I am setting up my VS Code environment for the first time, but I can't figure out how to set Chrome as the default browser for the workspace.
Go to file-> preferences -> user settings -> search "By Default it will open your default favorite browser" set your browser.
The other StackOverflow questions regarding the browser, had to do with opening a specific file. Here are the steps to creating a tasks.json file in a brand new environment.
From the Tasks menu, Select 'Configure Tasks'
The entry field prompts you for 'Select a task to configure'
Choose 'Create tasks.json file from template'
Edit the file to include the following block:
{
"version": "0.1.0",
"command": "Chrome",
"windows": {
"command": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
},
"args": ["${file}"]
}
Chrome can be launched by way of debugging your application. Within launch.json, the configurations[].serverReadyAction.action configuration was given a possible value of debugWithChrome in the VS Code February 2019 release. Note that this will also require you have the Debugger for Chrome extension installed. You will not receive a warning if the extension is not installed and you've configured launch.json to use debugWithChrome.
Note: Configuring launch.json with debugWithChrome will work even if you launch using CTRL+F5 to run the app without debugging.
Go to Settings -> Extensions -> Live Server Config -> Update Default Browser:
This Alternate Way helped me:)
GoTo-->Google Chrome-->Settings-->Default browser-->Set Google Chrome as default browser
The method of modifying tasks.json no longer works in newer versions of Visual Studio Code. The easiest way to be able to launch your code in a browser is to install the Open in Browser extension from the marketplace.
After it is installed and VS Code is reloaded, you can go to your code and press ALT + B to launch your application in your default browser or ALT + SHIFT + B to select the browser you want to use.
You can also right click and select these option from a drop down menu, but I mention this last because this currently does not work in some versions of VS Code.
Just a helper for the windows users, I just installed windows 10 again and I was wondering how do I set my vscode to open the server (web) using chrome instead of edge, so to do that you just have to configure your windows to use google chrome as default, you don't need to change anything in vscode, I hope this helps someone.
ps: normally you can go open browser you want to be default and setup the configuration. so in chrome you have to go to configurations and scroll down to default browser.
When you want to use your own browser using "Open with Live Server" without change OS globally configuration.
In Windows, Visual Studio Code (ver. 1.70.1 (July 2022)). Go to "File" > "Preferences" > "Settings"
Then select a tab, "User" tab if you want your desired browser for all your projects, or select "Workspace" tab or "ProjectName" tab for especified projects.
Then go to "Extensions" > "Live Server Config" > "Settings: Custom Browser" finally change the 'null' value selecting the browser of your preference from the list (apparently this list depends on installed browsers but i'm not sure).
search for local.testsettings on vscode on the search and for web tests, change the browser to chrome and apply.
The Live Server extension was not appearing for me on settings. However, I installed Open in Browser and typed "liveServer.settings.CustomBrowser" in settings and the extension appeared with a dropdown box in which I was able to change the default browser.
Hope this helps!
This may be old but I found something that could help.
First go to Settings/Apps/Default Apps. Set your browser as default.
Next go to VSCODE and go to File/Preferences/Settings/Extensions/LiveServerConfig
Then scroll to settings: CustomBrowser
Change it to your custom browser
Note- If the browsers don't show up on VSCODE then you need to set it to default in the settings.
You can adjust settings in your computer to open.HTML file extensions in chrome as a default browser:
for Example in PC windows:
go to Control Panel > Default programs > Associate a file type or protocol with a specific programs >HTML extension and choose Chrome.
In my case changing the default browser in the system settings of my pc did it.
None of the above works in my case(my version is August 2022 1.71) to make it work I went straight to **
File-->Preferences-->Settings-->Extensions-->Plugin open-in browser
** from there was a option which says Default set browser so I choose Brave as there is no ads in it while playing the video as chrome plays ads so for getting a proper feeling of using my self made Jarvis I used Brave.
Thanks
Click settings -> enter: default browser -> find: Open-in-browser:Default -> enter: Google Chrome
Google Chrome > Settings (left sidebar) > Default browser = Google Chrome
Just change your default web browser in your OS.
In Windows 10, you can search "default browser" then the wizard for changing it, will be appear.

Error while fetching extension. XHR failed

This is my first time installing and using VSCode, and when I try to install a python extension inside a VSCode application I get the error "Error While fetching extension. XHR failed" . How do I fix it?
image
first you open Vscode programming and do the following steps.
Press f1
Search user setting
Click enter
Search on user setting "proxy"
Click enter
Look for "use the proxy support for extensions."
Change override to on
The problem usually occurs because of the proxy settings.
try the following steps:
1.setting
2.proxy settings
3.Enable Detect automatically setting
4.restart
or
go to google search https://marketplace.visualstudio.com/
search for python then install python.
vscode->option-> user-> search 'proxy' ->clear 'http proxy" , it will be ok

the live server extention is not functioning, What should I do now? I tried to change the extention settings but coudn't fix it

The error promt says : "Server is started at 5500 but failed to open in browser preview. Got browser preview extension installed?"
In your setting, you can navigate to the Extensions and to the Live Server Compiler section. There, uncheck the box labeled "Live Server > Settings: Use Browser Preview"
If this doesn't help, try reinstalling the extension and check if vscode is running on the latest version

How come I can't open my .html with Live Server in VSCode?

I installed Live Server in VSCode for the first time and am trying to open an .html file with Live Server. I'm following the simple instructions provided here on the official installation page, but to no avail.
I right-click my file in the Explorer as instructed, but "Open With Live Server" doesn't show. I've even tried right-clicking the tab and that doesn't work either. I've quit and re-started VSCode and that didn't work. I set Chrome as my default browser in settings.json and that didn't work. I double checked to make sure Live Server is installed and enabled globally and it is. Please help me figure out what's going on! Thank you!
Oh! I figured it out. I had to open my file by selecting "Open Folder" and then open my folder from there. Then I was able to select my file under the Explorer tab and right-click to open with Live Server. I'm not sure why it worked that way.
It's happened to me few times. My problem was the folder and files names.
Check those names and don't use spaces or weird characters.

Getting connect ETIMEDOUT when trying to install a VSCODE extension

When trying to install a VSCODE extension from the marketplace, I'm getting connect ETIMEDOUT xxx.xxx.xxx.xxx:443 possibly due to company firewall restrictions.
Is there a way to download and install extensions from a local drive? I couldn't find a "download" option on the VSCODE marketplace.
You need to add your corporate proxy to VSCode settings.
Step 1.
Open File > Preferences > User Settings
Step 2.
Copy and Paste below into the settings.json (file that opens) make sure is inside the curly brackets {}
//-------- HTTP configuration --------
// The proxy setting to use. If not set will be taken from the http_proxy and https_proxy environment variables
"http.proxy": "http://127.0.0.1:8080", //your corporate proxy
// Whether the proxy server certificate should be verified against the list of supplied CAs.
"http.proxyStrictSSL": false
Step 3.
Press F1 and type Reload Window and press enter to refresh.
Tip: if you don't know your corporate proxy settings, follow this
advice:
https://superuser.com/questions/346372/how-do-i-know-what-proxy-server-im-using
Here is what you can do.
Most extensions are in public repos. Click Getting Started on the side panel.
Download the code from the public repo.
Follow the instructions in the docs to side load the application.
If you want to share your extension or customization with others
privately, you can simply send them a copy of the output from the
generator and ask them to add it under their .vscode/extensions
folder. Alternatively, package your extension using the vsce
publishing tool and send them the .vsix file.
Add proxy configuration to VS Code
Open VS Code as Administrator
Open File > Preferences > User Settings
Add following configuration to the open file.
{
"http.proxy": "http://userName:password#companyProxyURL:portNumber",
"http.proxyStrictSSL": false
}
Same issue. VS Code clearly not talking to extension server.
code --install-extension <extension>
gave a time-out message.
Turned out that I had bogus settings of HTTP_PROXY and HTTPS_PROXY. Unset the environment variables and VS Code worked beautifully.