Web - VSCode launches on localhost:8080 by default, refused to connect
See original GitHub issueDescribe the bug It is concerning that the default Flutter app created in VSCode has a configuration that prevents a workable launch, following the official doc instructions. There is also no official documentation (and limited online community) coverage on this issue.
To Reproduce Steps to reproduce the behavior:
- Install VSCode and Flutter according to https://flutter.dev/docs/get-started/install/macos#web-setup
- Create a new Flutter app in VSCode
- Click Run > Run Without Debugging
- Chrome window opens with localhost:8080, page shows refused to connect error
- If I launch by terminal, or replace the default “pwa-chrome” config in launch.json by the following
{
"name": "Flutter for web",
"type": "dart",
"request": "launch",
"program": "lib/main.dart",
"args": [
"-d",
"chrome"
]
}
then it launches as desired
Expected behavior
- Click Run > Run Without Debugging
- Chrome window launches with the app
Screenshots If applicable, add screenshots to help explain your problem.
Versions (please complete the following information):
- VS Code version: 1.50.1
- Dart extension version: 3.15.1
- Dart/Flutter SDK version: 1.23.0-18.1.pre
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Visual Studio Code debugger with Chrome refused to connect ...
I set up a brand new simple project with an index.html file to try to get Visual Studio code to launch it in...
Read more >localhost refused to connect | VS code error for HTML - YouTube
Common error faced by the most beginner VS code user.This can be perfect solution for those who are looking to solve localhost error...
Read more >Localhost Refused to Connect - How to Fix the Error
How to Solve the Localhost Refused to Connect Error? · Temporary Disable the Firewall · Check Localhost IP Address · Check Apache Server...
Read more >Localhost Refused to Connect Error: 5 Confirmed Ways to Fix It
Localhost refused to connect error can be caused by an incorrectly configured port, insufficient permissions, or an inoperative web server.
Read more >localhost refused to connect - Visual Studio Feedback
I launch VisualStudio 2017 Professional, I create a first new Project ... Added a binding for https on the default web server from...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah, I see.
pwa-chrome
is not related to this extension, and therefore we can’t control what it does. I suspect when you tried to run the project you didn’t have a Dart file open, so it should’ve shown this prompt:Here only the “Dart & Flutter” option will invoke our code. If you run the others, it will invoke their debuggers.
Let me know if you have any further issues/questions!
@DanTup Thanks for your replies and explanations. It helped a lot for me and hope it helps others. I voted for the issue you opened. Any of the solutions would indeed make more sense and be less confusing (at least for beginners). Anyway, thanks a lot