Live server vs code не работает ubuntu

Сервер Visual Studio Code Live не работает

VSCode имеет множество отличных расширений, и Live Server — одно из лучших.

Всего за пару кликов Live Server позволяет увидеть вашу страницу в реальном времени в реальном браузере. Более того, он имеет функцию перезагрузки в реальном времени, поэтому, если вы обновите свой код, изменения также будут отражены в браузере.

Все, что вам нужно сделать, это щелкнуть правой кнопкой мыши HTML-файл, который вы хотите просмотреть, затем щелкнуть правой кнопкой мыши и выбрать «Открыть с помощью Live Server»:

Читайте также:  С передней части не работают наушники

Но что, если Live Server не открывает ваш браузер и не отображает вашу страницу так, как вы ожидаете? Если это происходит с вами, вот несколько вещей, которые вы можете попробовать.

Перезапустить VSCode

Иногда лучшее, что вы можете сделать, — это запустить VSCode с нуля.

Во-первых, сохраните всю свою работу. Затем закройте VSCode, который также остановит все установленные вами расширения.

Затем снова откройте VSCode и попробуйте еще раз — перейдите к HTML-файлу, который вы хотите просмотреть, щелкните правой кнопкой мыши и выберите «Открыть с помощью Live Server».

Установите браузер для Live Server

Возможно, расширение работает, но в вашей системе нет браузера по умолчанию.

Даже если вы установили браузер по умолчанию для своей системы, не помешало бы сообщить Live Server, какой браузер вы хотите использовать явно.

Сначала откройте Command Pallete с помощью F1, затем введите Preferences: Open Settings (JSON) и выберите эту опцию.

Это откроет ваш settings.json файл VSCode .

Прокрутите файл до конца и вставьте его «liveServer.settings.CustomBrowser»: «chrome» .

Прокрутите файл до конца, добавьте запятую после последнего параметра и вставьте «liveServer.settings.CustomBrowser»: «chrome» :

Обратите внимание, что вы также можете использовать «firefox» , «safari» или любой другой браузер в качестве значения «liveServer.settings.CustomBrowser» параметра.

Наконец, сохраните settings.json файл и попробуйте снова запустить Live Server.

Установите браузер по умолчанию для вашей операционной системы

Даже после того, как Live Server сообщил, какой браузер вы хотите использовать, возможно, что он по-прежнему неправильно открывает вашу страницу в этом браузере.

Следующее, что нужно попробовать, — это установить браузер по умолчанию для самой операционной системы.

Точный метод для этого может варьироваться в зависимости от вашей операционной системы, поэтому лучше поискать, как это сделать, если вы не уверены.

Вот как выглядит страница настроек в Windows:

Зайдите на живую страницу сами

Если по какой-то причине Live Server по-прежнему не открывает страницу в вашем браузере автоматически, не беспокойтесь. Вы всегда можете открыть любой браузер по вашему выбору и просмотреть страницу напрямую.

Просто откройте предпочтительный браузер и перейдите в //127.0.0.1:5500/ .

Например, если ваш файл называется index.html , просто перейдите по ссылке //127.0.0.1:5500/index.html .

Пока работает Live Server, вы должны видеть свою страницу.

В заключение

Это несколько распространенных исправлений, которые вы можете попробовать, если Live Server не работает так, как вы ожидаете.

Оставайтесь в безопасности и счастливого (живого) программирования.

Источник

Live server installed but not working in VS code

I have installed the live server extension but the browser does not update after I save my HTML or other files. What might be causing a problem?

11 Answers 11

I had this problem and I solved it by changing the port number in the settings.json file to an opened one.

To get to the settings.json file you just click CTRL + SHIFT + P , then type «settings», click the «Preferences: Open Settings (JSON)», then paste this inside the < >:

This will randomly pick an opened port each time. This is how my JSON file looks like:

If there are multiple lines in the JSON file, make sure each line is separated by a comma( , ), like this:

Re-install the extension and restart your text editor to fix the issue.

If live server is not runnning and rendering html page on port 5500,for example http://127.0.0.1:5500/index.html not working.

Then this may be due to connection issue on your system.

I had same problem when i was compiling below html page:

Solved it by changing live server settings to my local IP and it fixed issue.

My local ip: http://192.168.2.16:5500/index.html is rendering changes on fly and working.

This works for anyone for whom live server is not running by default with port 5500.

It is because you have added insufficient paths in your Environmental variables.

First you can do is close the vs code

Go to the properties of My Pc

Click on Advanced Settings

click on Environmental Variables

from there you can add path clicking the path variables in the table shown there 6 . Add a new line to the path and copy paste the path of your system 32

hope this solution works in your case

Live server started but still isn’t opening the page in your browser automatically

Note: some time port number 5500 will be changed to 5501

I had a space in the file name, where the index.html was to be found.
Like: 3. Typography .
Just got rid of the space: 3.Typography because (of course) we can not have empty spaces in a url.

its easy to solve. just open setting by (ctrl + ,)and pick commonly Used first field is a (Auto save) Its value is by default off you must change it to After delay

I have same problem then i solve it by deleting all settings of live server from settings.json file and reinstall live server extension and now running it correctly.

Turn on the autosave feature on. File-> AutoSave

Please use the proper HTML syntax which is 👇

Being a newbie to web development, 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.

Also, make sure that the autosave feature in vscode is enabled, which you can do by going to vscode settings shortcut : Ctrl + , and then type autosave. Change Files: Auto Save to afterDelay and if you want to view the changes in your code instatenously, edit Files: Auto Save Delay to 1 .

Источник

VSCode server can not start on WSL (Ubuntu 19.10) #1744

Comments

ScarletFlash commented Oct 25, 2019

  • VSCode Version (insider):

Version: 1.40.0-insider (system setup)
Commit: 29ffbfe3f1c21b01a2d0670170855669dd2b3b4f
Date: 2019-10-25T14:03:31.497Z
Electron: 6.0.12
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.18362

  • VSCode Version (regular):

Version: 1.39.2 (system setup)
Commit: 6ab598523be7a800d7f3eb4d92d7ab9a66069390
Date: 2019-10-15T15:35:18.241Z
Electron: 4.2.10
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.18362

Distributor ID: Ubuntu
Description: Ubuntu 19.10
Release: 19.10
Codename: eoan

Steps to Reproduce:

  1. use WSL with Ubuntu 19.10
  2. run VSCode
  3. install Remote — WSL extension
  4. pick Remote — WSL: New Window
  5. get errors in terminal:

Does this issue occur when all extensions are disabled?: Problem is closely related to Remote — WSL extension

The text was updated successfully, but these errors were encountered:

vscodebot bot commented Oct 25, 2019

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

ScarletFlash commented Oct 25, 2019 •

May be important: https://github.com/andy-5/wslgit – I use v.0.7.0 (wslgit-mount-at-root.exe).
Also, I can say, that firstly this problem occured, afted upgrading from Ubuntu 19.04 to Ubuntu 19.10.

aeschli commented Oct 28, 2019

Can you do a ls -al /home/▮▮▮▮▮▮▮/.vscode-server/bin/6ab598523be7a800d7f3eb4d92d7ab9a66069390 to see if there really is an installation or wheter the installation got corrupted?

The log says it discovered an existing installation, is that possible?

ScarletFlash commented Oct 28, 2019 •

Can you do a ls -al /home/▮▮▮▮▮▮▮/.vscode-server/bin/6ab598523be7a800d7f3eb4d92d7ab9a66069390 to see if there really is an installation or wheter the installation got corrupted?

The log says it discovered an existing installation, is that possible?

Same problem on 2 PCs. Both have regular and Insiders VSCode installed.

aeschli commented Oct 28, 2019

So the 6ab598523be7a800d7f3eb4d92d7ab9a66069390 folder is there, but all empty?

ScarletFlash commented Oct 28, 2019

So the 6ab598523be7a800d7f3eb4d92d7ab9a66069390 folder is there, but all empty?

aeschli commented Oct 28, 2019

That’s very strange.
Can you

  • set «remote.WSL.debug»: true ,
  • close VSCode,
  • rm -r /home/▮▮▮▮▮▮▮/.vscode-server/bin/6ab598523be7a800d7f3eb4d92d7ab9a66069390
  • start VSCode, open a WSL window
  • send me the WSL log (in the terminal)

ScarletFlash commented Oct 28, 2019

Sure. I’ll do it tomorrow.

ScarletFlash commented Oct 29, 2019 •

  • set «remote.WSL.debug»: true ,
  • close VSCode,
  • rm -r /home/▮▮▮▮▮▮▮/.vscode-server/bin/6ab598523be7a800d7f3eb4d92d7ab9a66069390
  • start VSCode, open a WSL window
  • send me the WSL log (in the terminal)

aeschli commented Oct 30, 2019 •

When you start VSCode again, do you run the VSCode Windows app or do you start from the WSL shell code . ?

It’s really a mystery to me how /home/▮▮▮▮▮▮▮/.vscode-server/bin/6ab598523be7a800d7f3eb4d92d7ab9a66069390 suddely is there (again) after you just deleted it.
After you delete the folder, can you call C:\WINDOWS\System32\wsl.exe -d Ubuntu -e sh -c «[ -d

/.vscode-server-insiders/bin/33cc09da7a314ea0ee5677d1927739af60d16734 ] && echo found || ([ -f /etc/alpine-release ] && echo alpine || echo x64)» from a Windows shell?
The result should be x64
Same when calling sh -c «[ -d

/.vscode-server-insiders/bin/33cc09da7a314ea0ee5677d1927739af60d16734 ] && echo found || ([ -f /etc/alpine-release ] && echo alpine || echo x64)» from the Ubuntu WSL shell.

If you have any idea how or when the folder appears, help would be very appreciated.

ScarletFlash commented Oct 30, 2019

When you start VSCode again, do you run the VSCode Windows app or do you start from the WSL shell code . ?

I always run the VSCode Windows app.

WSL terminal:

Windows PowerShell:

/.vscode-server-insiders/bin/31f577ec88dc96ad2028699fb597b19022224b46 ] && echo found || ([ -f /etc/alpine-release ] && echo alpine || echo x64)» x64 «>

WSL terminal:

ScarletFlash commented Oct 30, 2019 •

If you have any idea how or when the folder appears, help would be very appreciated.

Sorry, I have no idea, but I believe that the problem is related to current Ubuntu version. I have found two problems after upgrading to 19.10 from 19.04 – this one and tj/n#594, that could be related to tar or gzip package. If vscode-remote uses tar or gzip , problem should be in it.

ScarletFlash commented Oct 31, 2019 •

Just retried running VSCode Server inside WSL.

ScarletFlash commented Oct 31, 2019 •

I see almost the same output, as here tj/n#594:

[2019-10-31 09:44:46.262] /bin/gzip: 10: Syntax error: «(» unexpected
[2019-10-31 09:44:46.262] tar: Child returned status 2
[2019-10-31 09:44:46.262] tar: Error is not recoverable: exiting now
[2019-10-31 09:44:46.262] + FILE_COUNT=0
[2019-10-31 09:44:46.262] + P=0
[2019-10-31 09:44:46.262] + tar -xf /c/Users/▮▮▮▮▮

1.USA/AppData/Local/Temp/vscode-remote-wsl/93ee2fc3121b7f66ddf568c051f3bfff7db8d618/vscode-server-linux-x64.tar.gz -C /home/▮▮▮▮▮▮▮/.vscode-server-insiders/bin/93ee2fc3121b7f66ddf568c051f3bfff7db8d618-1572515085 —strip-components 1 —verbose
[2019-10-31 09:44:46.262] + I=1
[2019-10-31 09:44:46.262] + read -r _
[2019-10-31 09:44:46.262] /bin/gzip: 10: Syntax error: «(» unexpected
[2019-10-31 09:44:46.262] tar: Child returned status 2
[2019-10-31 09:44:46.262] tar: Error is not recoverable: exiting now

So, the thing is that the gzip package is corrupted on both my PCs, or something is wrong with VSCode server?

I have made clean installation of Ubuntu 19.10 (WSL) on my laptop. – Problem still occurs.

Источник

Visual Studio Code Live Server Not Working

VSCode has a lot of great extensions, and Live Server is one of the best.

With just a couple of clicks, Live Server lets you see your page live in an actual browser. Better yet, it features live reloading, so if you update your code, the changes are also reflected in the browser.

All you have to do is right click in the HTML file you want to view, right click, then select «Open with Live Server»:

Live Server in action

But what if Live Server doesn’t open your browser and show your page like you expect? If this is happening to you, here are a few things you can try.

Restart VSCode

Sometimes the best you can do is start VSCode from scratch.

First, save all of your work. Then close VSCode, which will also stop all of the extensions you’ve installed.

Then, reopen VSCode and try again – go to the HTML file you want to view, right click, and select «Open with Live Server».

Set the browser for Live Server

It’s possible that the extension is working, but your system doesn’t have a default browser.

Even if you did set the default browser for your system, it wouldn’t hurt to let Live Server know which browser you’d like to use explicitly.

First, open the Command Pallete with F1, then type in Preferences: Open Settings (JSON) and select that option.

This will open your VSCode settings.json file.

Scroll all the way to the bottom of the file, add a comma after the last setting, then paste in «liveServer.settings.CustomBrowser»: «chrome» :

Note that you can also use «firefox» , «safari» , or any other browser as the value for the «liveServer.settings.CustomBrowser» setting.

Finally, save the settings.json file and try to run Live Server again.

Set the default browser for your operating system

Even after telling Live Server which browser you want to use, it’s possible that it’s still not opening your page in that browser correctly.

The next thing to try is to set the default browser for your operating system itself.

The exact method for doing this can vary based on your operating system, so it’s best to search for how to do this if you aren’t sure.

Here’s what the settings page looks like in Windows:

Credit: Advitya-sharma

Go to the live page yourself

If for some reason Live Server still isn’t opening the page in your browser automatically, no worries. You can always open the browser of your choice and view the page directly.

Just open your preferred browser and go to http://127.0.0.1:5500/ .

For example, if your file is called index.html , just go to http://127.0.0.1:5500/index.html .

As long as Live Server is running, you should see your page.

In closing

Those are a few common fixes you can try if Live Server isn’t working the way you expect.

Stay safe, and happy (live) coding.

If this article was helpful, tweet it.

Learn to code for free. freeCodeCamp’s open source curriculum has helped more than 40,000 people get jobs as developers. Get started

freeCodeCamp is a donor-supported tax-exempt 501(c)(3) nonprofit organization (United States Federal Tax Identification Number: 82-0779546)

Our mission: to help people learn to code for free. We accomplish this by creating thousands of videos, articles, and interactive coding lessons — all freely available to the public. We also have thousands of freeCodeCamp study groups around the world.

Donations to freeCodeCamp go toward our education initiatives and help pay for servers, services, and staff.

Источник

Оцените статью