Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

.vscode\settings.json - Live server port number updated continuously preventing live server from running. #147410

Closed
stemixreal opened this issue Apr 13, 2022 · 5 comments
Labels
*caused-by-extension Issue identified to be caused by an extension

Comments

@stemixreal
Copy link

stemixreal commented Apr 13, 2022

Does this issue occur when all extensions are disabled?: No - but it can't be reproduced without Live Server loaded.

  • VS Code Version: 1.66.2 (user setup)
  • OS Version: Windows_NT x64 10.0.19043

Steps to Reproduce:

  1. Open a static web app project with an existing api (haven't teted with new api yet)
  2. Open a web page with - "Open with Live Server" from context menus.

At that point this happens -

  1. settings.json is updated with a new live server port number
  2. A flashing "1 file unsaved" message appears in the explorer pane.
  3. the above 2 steps repeat until I restart vscode

I reported this in live server isue 2405 but there has been little activity from the developer recently so I checked here.

After running Bisect, I receive a notification that it finds no issues with any extentions and the problem may be with Code.

This only happens in a static web app projects with an api. So I can view web pages in projects that have no api.

before:
image

bug:
image

you can see the port number has been incremented, +1 each time, it took a few tries to capture the flashing, "1 file unsaved", message. the caption for settings.json also shows the circle for unsaved.

Of course this has all been working fine for ages and sods law means it happens when I have a deadline close lol. The only things that have changed since everything worked is I uninstalled a gist extension and vscode has had an update.

@IllusionMH
Copy link
Contributor

/causedByExtension

This is issue cause by extension itself see ritwickdey/vscode-live-server#330

Looks like it does this each time when port is closed, so make sure you close servers before starting new.

@stemixreal stemixreal changed the title .vscode\settings.json - Live server port number updated continously preventing live server from running. .vscode\settings.json - Live server port number updated continuously preventing live server from running. Apr 13, 2022
@stemixreal
Copy link
Author

stemixreal commented Apr 13, 2022

@IllusionMH , thanks for that link. Unlikely I'd have found it, I did look. It seems related but I'm not 100% sure it's the issue. Why would LS step through ports not in use? Even if some were in use, in this case they aren't, not all would be used. It happens on first run and loops - updating the port number and flashing at me until I restart vscode. If I open another project without an api live server works as expected, without closing the server and using the last port assigned that failed with the api project.

@IllusionMH
Copy link
Contributor

It's hard to say why it does that, but without details I think it's hard to see if there is something wrong with VS Code or just extension/underlying npm package don't support new version of Electron (and bundled Node.js as npm package has issues reported for Node.js 16)

You can try to downgrade by installing version from previous release notes (at the top of the page) https://code.visualstudio.com/updates/v1_65 and disable updates until you find alternative way to run servers.

@stemixreal
Copy link
Author

Thanks, there's several alternatives. I use the swa cli too anyway so I'll use that.

@github-actions github-actions bot locked and limited conversation to collaborators May 28, 2022
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
*caused-by-extension Issue identified to be caused by an extension
Projects
None yet
Development

No branches or pull requests

3 participants
@IllusionMH @stemixreal and others