ritwickdey / vscode-live-server

Launch a development local Server with live reload feature for static & dynamic pages.
https://ritwickdey.github.io/vscode-live-server
MIT License
5.66k stars 1.23k forks source link

live server not reloading automatically #452

Open hillar10n opened 5 years ago

hillar10n commented 5 years ago

I'm submitting a...


[x] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  <!-- Please search GitHub for a similar issue or PR before submitting -->
[ ] Feature request
[x] Documentation issue or request

## Current behavior

live server not reloading automatically

## Expected behavior

it reload without manually reloading the browser

## Environment

```html
Browser:

- [x] Chrome (desktop) version 
- [x] Firefox version 

For Tooling issues:

- Live Server: 5.6.1
- Platform:  Windows
- Visual Studio Code: 1.33.1
Enio11 commented 3 years ago

Can anyone help me please

I'm submitting a...

[x] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  <!-- Please search GitHub for a similar issue or PR before submitting -->
[ ] Feature request
[x] Documentation issue or request

## Current behavior

live server not reloading automatically

## Expected behavior

it reload without manually reloading the browser

## Environment

```html
Browser:

- [x] Chrome (desktop) version 
- [x] Firefox version 

For Tooling issues:

- Live Server: 5.6.1
- Platform:  Windows
- Visual Studio Code: 1.33.1

What is the solution for this ?

I think it was the VSCode Update, cuz until then mine was working normally after updating

AthulBabu232000 commented 3 years ago

I have a solution : 1. create a seperate js file

  1. write the js code to reload html page automatically onchange or ontimeinterval
  2. I am using it currently like this
  3. Bye bye live server
carrijoga commented 3 years ago

In my case just change de autoSave work. Just change the configuration for afterDelay image

JeanMesa commented 3 years ago

Can anybody please answer me???

Hey! I ran into this issue today and here's what solved it for me. I'm assuming you're on OSX? If so, your shell was recently changed from bash to zsh. If this the case for you, you have to manually select a new terminal profile in vscode (zsh if available) or create one if unavailable. Here's how to get to those settings: CMD + Shift + P to open command in vscode (not terminal) then type in "terminal profile" and select "Select Default Profile". This will provide a list of terminal profiles recognized at that point by vscode. If zsh is NOT there, escape and open command palette again, type in terminal profile but this time selecting "create new integrated terminal (with profile)". From here create your zsh profile and set it as your default. Once done, go into your settings.json file and either remove or comment out the line that sets your default profile as this feature is now deprecated in newer versions of vscode and will not work and throw you a "PROBLEM" in vscode, nothing serious only severity 4 but it's really annoying. Anyway, please lmk if this helps! :)

Dwarageshg commented 3 years ago

I'm submitting a...

[x] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  <!-- Please search GitHub for a similar issue or PR before submitting -->
[ ] Feature request
[x] Documentation issue or request

## Current behavior

live server not reloading automatically

## Expected behavior

it reload without manually reloading the browser

## Environment

```html
Browser:

- [x] Chrome (desktop) version 
- [x] Firefox version 

For Tooling issues:

- Live Server: 5.6.1
- Platform:  Windows
- Visual Studio Code: 1.33.1

i had a same problem and got fixed https://www.youtube.com/watch?v=ivmcRXzGAEk see this video for help

markymauro13 commented 3 years ago

yeah this is not working on my desktop. However, it does seem to be working on my laptop.

cmalpicag commented 3 years ago

SOLVED (For me at least)

In settings search for "useWebExt" en check you DON'T have it enabled. I just unchecked this and now it's working!

This solution is worked for me. Thanks.

KR-blip commented 3 years ago

enable the autosave just go to file-> autosave

alextechtx commented 3 years ago

This has to be related to updates in VS Code causing random hiccups after being updated. While reading this, the only change I did was re-type my UTF-8, save and relaunch (Go Live) again and it started to work again. It was lowercase so I thought re-typing it as uppercase may help and it started working again. Now, 100% sure the uppercase vs. lowercase has nothing to do with it since I changed back to lower case and it is still working, but retyping, saving and relaunching it did trigger something that made it work.

Note: I did not try to reinstall, reset, nor attempted to create a new file. Would have been good troubleshooting, but fortunately did not have to spend much time on it.

kzamojcin commented 3 years ago

So... few things work here like a charm, for which I'm really grateful. Yet I have discovered a new one.

Just to recap:

Cheers o/

ujwal49 commented 3 years ago

SOLUTION Follow the below steps (which worked for me):

install live server extension in your browser and add the live server URL It reloaded automatically after I saved the file!!!

meowalien commented 3 years ago

Looks like the life server will only auto-refresh the full definition HTML file

<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
    </head>
    <body>
           // Your code
    </body>
</html>

I fix this by adding the above code

fazialnjd commented 3 years ago

click on auto save from file menu or push ctrl+s to auto update server it works for me!

michellethompson-github commented 3 years ago

I had the same issue. Until now, i couldn't figure out what's the problem. My environment: Windows 10 Chrome Version: 76.0.3809.100 (Official Build) (64-bit) VSCode 1.36.1 Live Server 5.6.1

So far, it's been a random occurrence for me when i encounter this "page doesn't reload automatically". I sometimes have it working after i click save, but only after a couple of minutes until the "auto-reload" doesn't work anymore. When i restarted my computer, it's a 50/50 chance that LiveServer will work correctly. Right now, i dont have a reliable solution as what may causing this problem. I think it could be my Windows 10, but i don't know how to check it.

After reading this post, I figured out that what I needed to do was click Auto-Save and then the automatic updates started working!@

eliteops commented 3 years ago

@ritwickdey-kreeti live server not refreshing on default firefox page .using alt+l+o nothing updated on page. kindly solve this issue. Screenshot (3)

KR-blip commented 3 years ago

Check if you have the option for auto save enabled or not. Enable it

On Mon, 16 Aug, 2021, 23:22 eliteops, @.***> wrote:

@ritwickdey-kreeti https://github.com/ritwickdey-kreeti live server not refreshing on default firefox page .using alt+l+o nothing updated on page. kindly solve this issue. [image: Screenshot (3)] https://user-images.githubusercontent.com/62295367/129607436-fcb92942-8103-40dc-90ed-07dab10da8df.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ritwickdey/vscode-live-server/issues/452#issuecomment-899701571, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUCKTSZZBGWEPG2YWHXKLDLT5FF5NANCNFSM4HISWZDA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

cmalpicag commented 3 years ago

https://github.com/ritwickdey/vscode-live-server/issues/452#issuecomment-862546673

@ritwickdey-kreeti live server not refreshing on default firefox page .using alt+l+o nothing updated on page. kindly solve this issue. Screenshot (3)

eliteops commented 3 years ago

@ritwickdey @KR-blip @cmalpicag After reinstalling vscode everything sorted. thanks guys for all your attention.

SergioChizhikov commented 3 years ago

SOLVED (For me at least) In settings search for "useWebExt" en check you DON'T have it enabled. I just unchecked this and now it's working!

This solution is worked for me. Thanks.

Thanks! You are simply the best person in my life! I have been suffering for a year and there was no time to find a solution. Today I searched again and I found your answer.

maitomm commented 3 years ago

SOLVED

In my case: I had my HTML file inside a folder, which name starts with a period .

Don't do this 👇

http://127.0.0.1:5500/.folder/index.html

Life Saver Solution!!

kshitij-agarwal commented 2 years ago

Please use the proper HTML syntax which is 👇

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Hello, World</title>
</head>
<body>
    My first Web dev code
</body>
</html>

Being a newbie, I was only using the head tag. The web page was working in the browser but the live server couldn't process it. You can get the above snippet in vscode by typing html:5 and then hitting tab.

yigtuyumz commented 2 years ago

Check your path. And also check your directory name. If your working directory or file contains special characters such as 'İ, Ö etc.', you may have some issues. For me , i got 'Ç' in my folder name. I changed 'ç' to 'c' and then I reloaded the extension. It worked withouth any problems.

philharlow commented 2 years ago

As a hold-over from using serve, I was running live-server --port=3000 ./ to serve the local directory. Removing the ./ fixed it for me

mikearthur7b0 commented 2 years ago

For me, the problem was the line <script src="src1.js"/> Live update worked when I changed it to <script src="src1.js"></script> Be sure to also follow the comments above to set up your <html> and <head> correctly: https://github.com/ritwickdey/vscode-live-server/issues/452#issuecomment-925845096

akshaykumar-kokitkar commented 2 years ago

Just uncheck the option "Use Web Ext". close your visual studio code. Open it again and your live server works fine by auto reloading.

MarceloHcb commented 2 years ago

RESOLVIDO

No meu caso: eu tinha meu arquivo HTML dentro de uma pasta, cujo nome começa com um ponto.

Não faça isso apontar para baixo

http://127.0.0.1:5500/.folder/index.html

Thanks

juliostricker commented 2 years ago

Eu tinha uma meu arquivo .html dentro de uma pasta cujo o nome começava com o caractere "#" e por conta disso o LiveServer não estava conseguindo atualizar automaticamente.

I had my .html file inside a folder whose name started with the character "#" and because of that the LiveServer wasn't able to update automatically.

Khalid-Supreme commented 2 years ago

I'm submitting a...

[x] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  <!-- Please search GitHub for a similar issue or PR before submitting -->
[ ] Feature request
[x] Documentation issue or request

## Current behavior

live server not reloading automatically

## Expected behavior

it reload without manually reloading the browser

## Environment

```html
Browser:

- [x] Chrome (desktop) version 
- [x] Firefox version 

For Tooling issues:

- Live Server: 5.6.1
- Platform:  Windows
- Visual Studio Code: 1.33.1

In my case just change de autoSave work. Just change the configuration for afterDelay image

29/11/2021 This worked perfectly, Thank you!. You all should check this out.

julianwachholz commented 2 years ago

HTML changes will not be detected when the folder name is html. I had an index.html that wouldn't update its contents. It worked once I renamed the folder or moved the file somewhere else.

jmsanchezfin commented 2 years ago

Looks like the life server will only auto-refresh the full definition HTML file

<html lang="en">
  <head>
      <meta charset="UTF-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Document</title>
  </head>
  <body>
           // Your code
  </body>
</html>

I fix this by adding the above code

This solved the issue

LeoCosta7 commented 2 years ago

For me, the problem was the line <script src="src1.js"/> Live update worked when I changed it to <script src="src1.js"></script> Be sure to also follow the comments above to set up your <html> and <head> correctly: #452 (comment)

This solved my problem too. Thank's man

justaprogrammer96 commented 2 years ago

I'm submitting a...

[x] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  <!-- Please search GitHub for a similar issue or PR before submitting -->
[ ] Feature request
[x] Documentation issue or request

## Current behavior

live server not reloading automatically

## Expected behavior

it reload without manually reloading the browser

## Environment

```html
Browser:

- [x] Chrome (desktop) version 
- [x] Firefox version 

For Tooling issues:

- Live Server: 5.6.1
- Platform:  Windows
- Visual Studio Code: 1.33.1

Make sure to put: in the code!

VictorCeSilva commented 2 years ago

enable the autosave just go to file-> autosave

Thanks. YOU SAVE ME! I LOVE YOU

krisrana commented 2 years ago

A simple fix to make sure the live server auto-refreshes is to add HTML boilerplate as such.

<!-- HTML boilerPlate -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

</body>
</html>
MCGirgin commented 2 years ago

You must press ctrl + s to save before closing visual studio.

Andresfgomez970 commented 2 years ago

In the hope it could help someone I describe how I solve my problem.

After the installation I got the warning "Visual Studio Code is unable to watch for file changes in this large workspace". I realized that I had left open a big project in a Visual Studio Code window (window 1), so it was not enough to simply close and open the window (window 2) in which I was editing the html. I close all windows and reopen, and now it is working perfectly.

divrawat commented 2 years ago

When I am saving my code and responsive mode is on live server just get disconnected but it is working properly when my screen is not in responsive mode. any Answers ???

priyanshunegi17 commented 2 years ago

For me, I didn't closed the script tag properly. now it's working fine.

dariorm410 commented 2 years ago

For me it was enough to click on "Go live" in the footer of the project Capturar

KMcKraken commented 2 years ago

After trying all suggestions, I finally had to do a complete reinstall of VSCode. This means wiping the software, which alone didn't work, wiping the extensions, which alone didn't work, and finally deleting the entire "%appdata%\code" folder. Only after this last step did the Live Server start working again for me. Seems there may have been come conflicts going on somewhere in there,

Now, I don't know what all is contained in that folder, but I'm personally okay with starting from scratch. Some may not be, so be careful what you delete.

This is just my experience.

wildermiranda commented 2 years ago

My folder name was with the character ( ' ). After I changed the name of the folder, the live server started working normally again.

Warning: Don't use some characters to name folders like ( . ), ( ' ) or ( # )

Hope it helps!

nickmura commented 2 years ago

Was having the same issue. Looks like it was as simple as how I was opening the file. When I go to File > Open Folder, it seems to work every time. When I open the individual files, it doesn't work. This thread was the key, Thank you!

UTF-8 charset was already set, this solved my issue.

BenM61 commented 2 years ago

might worth to mention- make sure the tags in your file are closed. I had this problem because of a open textarea tag that canceled the rest of the body

agabler commented 2 years ago

I went though all above setting options and advices and now it works. Thank you all! :) I spent 3 hours looking for solution!

So you should take all these steps:

-change settings in VS Code. If you go to Settings, search for these options and set them as below:

Live Server Settings: Custom Browser: chrome (I use chrome, you can choose yours of course) Full Reload: yes, you should mark it Port: 0 Use Web Ext: unmark it Wait: 3

Settings: autosave: afterDelay

-check if your HTML file name is correct (without special signs etc) and if there is utf-8 in -I also installed extension in my Chrome browser ("LiveReload")- you can download it in GoogleStore.

Save all changes, reopen chrome and VsCode and check if it works.

ehsanazali commented 2 years ago

in case someone still looking for answer: we dont need any sxtra setting or app. Just live server and VS, in VS go to setting and serach for "Auto Save" and change it to "afterDelay" than search for "Auto save Delay" and typ there "0" or "1". now its Working! hoho

p.s: Json file in case you are familiar with:

"files.autoSave": "afterDelay",
"files.autoSaveDelay": 1,
mandorakannu commented 2 years ago

Bro, I just fixed this issue. Go to vs-code settings and search autosave option then, select "AfterDelay" then your file automatic save and changes occur in live server shown. Thanks me later. 😊😊

katunzijr commented 2 years ago

index.html works fine. but how do i reload any file other than index.html, let say myfile.html doesint work on me.

SPARTAKRAGA commented 2 years ago

in my case the problem was Live Server > Settings : Full reload (checked)

ghost commented 2 years ago

.folder-name won't working. remove . before folder-name. it's success for me

preciousBlessed commented 2 years ago

Thanks @tahmidmahi04 ... you're a genius. I was in a folder like named like this: .vscode ...I guess the dot mean something. Once I created a new folder without a dot starting it, code started updating on its own ... life ...smooth... no stress... life Continues... Bless you son!