I was wondering if anyone possibly know the solution for this error
Error: connect ECONNREFUSED 127.0.0.1:80
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
I'm trying to run a live server while working on my html file but it's not letting me . I restarted my pc..same issue... restarted program...same issue... used localhost... same issue ...switched setting to chrome browser....same issue..
I also added (code below) to my JSON Settings file...Still running to the same issues. It was running fine last night and this morning it completely stopped working.
"liveServer.settings.CustomBrowser": "chrome"
I had the same issue.
I changed my settings in settings.json(live server extension settings)
to this .
It started working again !!!
I hope it's useful
{
"workbench.colorTheme": "Default Dark+",
"liveServer.settings.port": 5500,
"liveServer.settings.https": {
"enable": false,
"key": "",
"passphrase": "",
"cert": " "
},
"liveServer.settings.proxy": {
"enable": true,
"baseUri": "http://127.0.0.1:80",
"proxyUri": "http://127.0.0.1:80"
},
"liveServer.settings.CustomBrowser": "chrome",
"liveServer.settings.donotShowInfoMsg": true,
"liveServer.settings.host": "127.0.0.1:80",
"liveServer.settings.useLocalIp": true
}
ok so i had this same problem today and what i did was to go into file>setting look up live server and edit json and delete the settings there and saved and reloaded and it seem to start to work again.
Open VSCode and click File, Preferences, Settings than type in search settings Liveserver port The LiveServer Settings Port option will appear, click Edit in settings.json.
And set "liveServer.settings.port": 5500, save and close settings.json.
And If you have a .vscode directory in your project directory then remove it.
Restart VSCode and run Liveserver and keep on Coding! :-) Now it's should up and running;-)
Helpful screenshot:
I typed exactly same URLs in these two boxes and Viola! The issue was resolved.
Related
My Setup is the following:
I use a quite big python repository and code with VS Code with the following setup:
Version: 1.66.0 (user setup)
Commit: e18005f0f1b33c29e81d732535d8c0e47cafb0b5
Date: 2022-03-30T05:50:14.623Z
Electron: 17.2.0
Chromium: 98.0.4758.109
Node.js: 16.13.0
V8: 9.8.177.11-electron.0
OS: Windows_NT x64 10.0.19041
Since yesterday the debugger doesn't start anymore. When I start it with the buttons or with F5, the debug toolbar shows up for a second and then it vanishes again. The normal run works perfectly, as well as when I run my file from a terminal.
I didn't really change something that I can remember, only that VS Code did an automatic update on Monday evening.
There is no Terminal output that I can show, since it is not opening a Debugging Console.
I used the debugger always directly from the file that I needed to debug and didn't specify any launch.json files.
What I already tried, is as mentioned using not the Debugger, but the Run command and started the files from a terminal outside of VS Code. Then my code runs as intended. But since I need the debugger for my work, this is not a good solution.
I also went back a few commits to the last step where I know it was working, but this didn't change it at all.
I tried to debug a simple "hello World" python script but there I have the same problem.
I used the automatic add configuration from VS Code and it added the following launch.json file to the .vscode folder in the repo. Together with this file it added a configuration called "Python: Aktuelle Datei" (german for current file). This also didn't help when I'm trying to launch it with this configuration.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Aktuelle Datei",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true
}
]
}
Is there anyone who encountered a similar issue?
I'm setting up linting with golangci-lint in my Go project. I have a file generated by go-bindata that VSCode is listing the following under the Problems tab:
assets/assets.go: redundant type from array, slice, or map composite literal (simplifycompositelit)
I can't seem to get rid of it. It's not a compiler error and I'll be re-running go-bindata from time to time so I don't want to make a habit of modifying generated code.
Right now, with the configuration below, I can't make VSCode stop reporting this error. If I run golangci-lint run ./... in the root of the workspace I get no output. I can provide my linting config if needed but VSCode seems to be running something else. How do I figure out what's reporting this error and how do I make it stop reporting anything for the file assets/assets.go in this one workspace?
Here's Go-related vscode settings:
{
"go.formatTool": "gofmt",
"go.lintTool": "golangci-lint",
"go.liveErrors": {
"enabled": true,
"delay": 500
},
"go.lintOnSave": "workspace",
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"go.useLanguageServer": true,
"go.languageServerExperimentalFeatures": {
"diagnostics": true,
"documentLink": true
},
}
Here's the line in question even with a nolint comment to show it's not behaving as expected. If it were golangci-lint outputting this, the nolint would prevent the warning from showing. I reloaded the window and closed/reopened vscode to be sure the change was noticed.
After reproducing locally, it seems this message comes from gopls, as disabling gopls silences the message. There are a couple of related complaints/issues on the Go issue tracker:
hide gofmt -s diagnostics (and others?) in generated files
should not issue lint-style warnings on generated code
Neither offers an actual solution.
However, this issue on the vscode-go repo, provides a work-around. In your VSCode config, add the gopls.analyses.simplifycompositelit key, with a value of false:
"gopls": {
"analyses": {
"simplifycompositelit": false
},
}
Of course, this disables it for all projects, not just generated files, but if you're also using golangci-lint, it can be configured to catch the same types of errors, and can be configured on a more granular basis, so that you won't miss the same class of errors in non-generated code.
I've just started noticing something strange in VSCode 1.24.1 on MacOS 10.12.6 Sierra.
My file explorer has been marking my current working directories as "unresolved". This does not prevent me from doing anything I normally would though I am wondering why this is happening. The folder name will be yellow and will be marked with an ! on the right.
I've tried closing and reopening the directories in my file explorer, restarting VSCode itself and moving the folder to a separate directory. Nothing doing.
I haven't been able to find much on the issue except in the case of people working in Typescript files that aren't properly configured in a manifest file on React projects. These are mostly HTML/CSS/Sass/JS/MySQL.
Any insight would be appreciated, thank you.
I was having the same issue on Windows when I had previously created different projects on the undefined workspace (the default workdspace of VSCode).
When I create a workspace and I placed my root folders inside this one workspace, it will warn that it could not resolve workspace folder.
You have to edit your workspace config file, change the path of your folders and then restart VSCode.
On the VSCode command palette, type: workspace config - then choose "Open workspace configuration file."
You should have something like this:
{
"folders": [
{
"path": "OneProject"
},
{
"path": "AnotherProject"
}
],
"settings": {}
}
What you want is something like this:
{
"folders": [
{
"path": "C:/Somewhere/OneProject"
},
{
"path": "C:/Somewhere/AnotherProject"
}
],
"settings": {}
}
It's a known issue, it was fixed here - https://github.com/Microsoft/vscode/issues/50866
As of the 1.24.1 version it's not yet available. But the fix listed above should correct the problem you are having.
Replace ${workspaceFolder} with ${FOLDER_NAME:workspaceFolder} in your *.code-workspace file. (from here)
By the way, same goes to ${workspaceRoot}, you can replace it with ${FOLDER_NAME:workspaceRoot}.
Any more folder variables ca be fixed with this FOLDER_NAME: prefix? My workspaces did not use them so far.
Worked for me in Version: 1.44.2.
I had this issue also with VS and also showing an exclamation mark as well as the error code you have said, my solution was to go into my work folder where my file was located and in that folder i right clicked and re-arranged the folder so it was showing them as application order and it got rid of the error code and exclamation mark.
In my case I resolved this by restarting the WSL machine by writing the following in the windows cmd
wsl --shutdown
take care this might stop running docker containers and other related processes.
Then I started a new wsl terminal and vscode worked like a charm.
I deleted the folder and created a new one with a different name and it was fixed. No workspace config file fix needed as it fixes/updates itself when you change folder structure and update projects.
Please, remember to check what you opened. I struggled for this very stupid error for a day.
If you open VSCode, and then Open Folder, and then Add Folder, do not execpt theat ${workspaceFolder} will be you last folder, or the folder of your code. Its valeue will be the first folder you added...
I am currently trying to open a html file written in visual studio in google chrome browser and run Google Chromes debugging extension in visual studio
the following is the .json file and i am using the first configuration
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Chrome against localhost, with sourcemaps",
"type": "chrome",
"request": "launch",
"url": "http://localhost:8080",
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
},
{
"name": "Attach to Chrome, with sourcemaps",
"type": "chrome",
"request": "attach",
"port": 9222,
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
}
]
but when it open in google chrome i recieve the error
This site can’t be reached
localhost refused to connect.
I had the same issue.
There is a temporary solution that is to add "file": "${workspaceRoot}/index.html" to the launch.json config.
This change will allow you to open your webapp in the Chrome browser, and you will be able to do debugging, break points...however, take into account that the browser will render your project as if it was opeining a local file, and NOT using a webserver environment.
Here is the launch.json config file:
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceRoot}",
"file": "${workspaceRoot}/index.html"
}
]
}
After spending sometime with VScode debugging, I realized about the following facts:
VScode can debug natively any .js file.
VScode can debug .html & .js files with the help of extensions like
"Debugger for Chrome" (you need to apply #Machavity changes for rendering it without live-sever.
If you want to render your .html & .js files as it was a webserver (
similar to as if was being served from Apache ), you will need some
node extension like "live-server".
How to debug with "Debugger for Chrome" & "live-server" extension:
Change the configuration options for "Chrome debugger" in the
launch.json file, and make the parameter "url" to match the host that
the "live-server" will use for rendering: for example, localhost.
Open your index.html file and open the terminal, run "live-server".
You can customize the port, host and other settings of the
live-server from the command line.
Start the debugger and apply your breakpoints where necessary.
More info:
- Debugger for Chrome
- Node live-server
Finded out one more option:
run ng serve in terminal
press F5 in vscode to start chrome debugger
Found this related issue which recommends that the port is forwarded to the proper local IP address for your server (it may have changed) and make sure the firewall rules are setup properly on the server.
Another suggested solution based from this link is changing the port number in your project.
Project Properties -> Web -> Servers -> Project Url
You can also follow this workaround from this SO question:
Go to the LAN settings (in Chrome : Tools-> Options-> Under the hood -> Change Proxy setting -> LAN Setting)
There will be a checkbox for "Bypass proxy server for local address"
Tick the checkbox.
On Mac/Apple: Chrome uses system preferences for localhost exclusion:
Go to System Preferences -> Network -> advanced -> Proxy settings
add 'localhost' at the bottom where it says: 'ignore proxy settings for these hosts and domains' (exceptions are separated by a comma)
Hope this helps!
None of the other solutions worked (related to SO link in question), I didn't try the change hosts file solution. This solution below worked
https://www.webucator.com/blog/2016/06/launch-files-browser-visual-studio-code/
CTRL+SHIFT+P
CTR
"other" → tasks.json
Paste the following code:
{
"version": "0.1.0",
"command": "Chrome",
"windows": {
"command": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
},
"args": ["${file}"]
}
On the index.html file or whatever file your working on, press CTRL+SHIFT+B.
EDIT
This solution is not the best since it requires you to refresh / rebuild all assets everytime you make a change, making it rather slow, especially when you use jquery
EDIT EDIT
For anyone reading this I run windows 10 and tested almost every solution I possibly could on stackoverflow but just ended up using atom + atom-live-server which pretty much took me 5 minutes to install and setup. Setup on how to do it here: https://www.youtube.com/watch?v=xg-W86U6_Ng
I had the same issue, solved it by starting the server first, and then launch the chrome debugger.
You can't run the chrome debugger on a server that doesn't exist, or has been started.
Just modify launch chrome configuration and add this one line at the end
{
"name": "no change",
"request": "no change",
"type": "no change",
"url": "no change",
"webroot": "no change",
"file": "${file}"
}
I'm trying to download a file in my test. I've managed to start the download without getting the download prompt.
the problem now is that I'm getting a warning saying that "This type of file can harm your computer.Do you want to keep...anyway?" and I need to choose 'Discard' or 'Keep'.
I've tried to find chromeOptions for that - unsuccessfully.
currently using those args:
args: ['--disable-popup-blocking="true", --allow-unchecked-dangerous-downloads="true", --disable-download-notification="true"']
any ideas?
Took me a day of googling and almost gave up... but i found a solution from How to disable 'This type of file can harm your computer' pop up
Will post the solution here since it was frikin hard to track it down when using protractor as the keyword
prefs = {
'safebrowsing' => {
'enabled' => true,
}
}
oddly enough, you need to "turn on" safe browsing to make the message dissapear
Try the following flags:
--safebrowsing-disable-download-protection
--safebrowsing-disable-extension-blacklist.