Open a folder or workspace file open folder как исправить

Skip to content

При запуске локального сервера в среде VS code с использованием плагина Live Server появляется ошибка

Open a folder or workspace… (File -> Open Folder)

Open a folder or workspace file open folder

Для устранения ошибки в VS code переходим в проводник и жмем Открыть папку, далее указываем путь до файла index.html, жмем Ок.

открыть папку

Далее появится информационное окно 

Вы доверяете авторам файлов в этой папке?
Code предоставляет функции, которые могут автоматически выполнять файлы в этой папке.

If you don’t trust the authors of these files, we recommend to continue in restricted mode as the files may be malicious. See our docs to learn more.

С:site Доверять авторам всех файлов в родительской папке «с:»

Ставим галочку и жмем Да, я доверяю авторам

Вы доверяете авторам файлов в этой папки

Далее автоматически откроется проект

html код

и переходим в Open with Live Server

open with Live server

откроется браузер по умолчанию (как изменить браузер по умолчанию см. здесь) 127.0.0.1:5500/index.html

index страница сайта

server is started

2521


wondering if you could assist. Really challenging in determining a solution to this from my research.

Ive downloaded Visual Studio code two weeks ago and has come across an error once I try to debug a file. The file appears to open but once I run the debugger it shows accordingly:

‘${workspaceFolder}’ can not be resolved. Please open a folder.

Can’t seem to find or replicate a similar solution. I’ve also tried to reinstall Visual Studio code (no easy feat). I’m trying to at least understand the problem and its source.

The file is a .js file that I’ve been working on, running a simple function. It is not meant to operate in tandem with a larger workspace/program.

Lex Li's user avatar

Lex Li

59.9k9 gold badges116 silver badges146 bronze badges

asked Apr 15, 2020 at 20:28

Andrew Trac's user avatar

1

In VScode go to file —> Add folder to workspace and select the folder where the program files are located.

answered Jan 30, 2021 at 21:40

Meysam's user avatar

MeysamMeysam

4094 silver badges14 bronze badges

2

If you are using the latest Visual Studio 1.44, make sure to upgrade to 1.44.2.

The issue microsoft/vscode issue 94725 has been resolved.
It featured the same error message:

https://user-images.githubusercontent.com/9964210/78838126-65c76d80-79ed-11ea-8572-a092f1576dbc.png

After some investigation the problem is the following for the workspace configuration our debug extensions appends the following attribute

__workspaceFolder:'${workspaceFolder}'

And the configuration resolver properly tries to resolve this and complains because the scope of the folder is not specified.
In a multi root workspace scope has to be specified, otherwise the resolver does not know against which folder to resolve the variables.

Proposed fix: the node extension which adds this attribute should scope it if it sees that we are in a multi root folder.
So instead of ${workspaceFolder} use ${FOLDER_NAME:workspaceFolder}.

This is fixed in commit ae97613.

answered Apr 18, 2020 at 6:08

VonC's user avatar

VonCVonC

1.2m516 gold badges4341 silver badges5155 bronze badges

9

Replace ${workspaceFolder} with ${FOLDER_NAME:workspaceFolder} in your *.code-workspace file. (from [here][1])

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.

answered Apr 30, 2020 at 18:40

moudrick's user avatar

moudrickmoudrick

2,0981 gold badge21 silver badges33 bronze badges

I know this question is very old already and the answers may have been correct but none worked for me on vscode v1.57.1 at the time of this comment on 30.06.2021

I had to replace ${workspaceFolder} with ${workspaceFolder:my-folder-name} in my *.code-workspace file

Ref: Variables scoped per workspace folder

answered Jun 30, 2021 at 13:11

omostan's user avatar

omostanomostan

8108 silver badges9 bronze badges

I recently had this problem and so did I read the answers above but being a beginner I was unable to solve it .In my answer I don’t have exactly what you should do but I will show what worked for me.

  1. Go to the explorer and you will see there is no folder added.
  2. Browse for .vscode folder and select it.
  3. Issue solved {this atleast worked for me.It**(.vscode)** had .json extension file in it}.

DCCoder's user avatar

DCCoder

1,5874 gold badges14 silver badges29 bronze badges

answered Jan 12, 2021 at 3:45

Prasad_k's user avatar

I was having the same issue, but I solved it this way:
1- open VS Code as administrator
2- open the sheet
3- debugging with no problem :)

answered Apr 17, 2021 at 14:29

João Bittencourt's user avatar

@FDelrosario

Hi I was just wondering if you were able to solve this issue? I am experiences the same error.

@maks1981

Guys hello, i have the same problem but i could not solve it.
When i press Open with live server below message appears «Open a folder or workspace… (File -> Open Folder)», I opened any html file there many times but nothing about live server works ,guys how can i solve this?please any help
Kind Regards

Sahinujjaman-Rahaman, shubham-20120, Motorwal174, sondejq, nika1414, abhidhu, leticiasdd, cudhnam07, malikHarisawan, Jonaschmidt, and Kunalgaurav1 reacted with thumbs up emoji
AlaaSarhan9, Manghyi, OdaiSy, murlidharpathakprogrammer, musatoktas, kevinramadhan29, Jayasimha099, hichamsyc11, Harpreetkaur125, Sahinujjaman-Rahaman, and 42 more reacted with eyes emoji

@irfan339

hi

Want to known how to open more than one html file using live server in visual studio code
And when i try open more than one file with live server it is opening that files on same port, but when try to close live server for one file it is closing for all files opened on that port
So please tell me how to use live server for multiple files in visual studio code

@Pihu01

I’m facing the same issue can anybody help me please!
«Open a folder or workspace… (File -> Open Folder)»

@Pihu01

Wow! I got the solution,
whenever you try to open file without opening folder in visual studio code, then the issue occurs, to avoid this first open the folder(where code file already exist) in visual studio code, and then you can open live server by right click.
thank you

ginaWilma, 26MixesForCash, Roalknight, shettyadithya, LittleBlue418, StellarApp, adiHusky, NotYourTypicalDeveloper, FUTUREEEEE, vaov1999, and 242 more reacted with thumbs up emoji
Geek2452, Yashr29-max, rafaellang1, souza-jefte, HackerPractice, aman-git13, Rahim47, Axist8, Silferion, Gopipatwa, and 24 more reacted with laugh emoji
AlaaSarhan9, giddygarcia, rafaellang1, musatoktas, ocholuo, kulu123-z, aman-git13, elzurdo, Rahim47, Axist8, and 28 more reacted with hooray emoji
kulu123-z, aman-git13, Rahim47, itxDeeni, Axist8, AwaisKazimi, Gopipatwa, loglost, Wang-Kevin900, sdobnaya, and 47 more reacted with heart emoji
kulu123-z, elzurdo, Rahim47, cemenyo, Axist8, loglost, Wang-Kevin900, sdobnaya, shubham-20120, Asrover, and 16 more reacted with rocket emoji
luisprz, jenwesi, JayP11, Aaryajith, Echolano, emman01-ship, Diego223, hanselpinto, and MaeenMo reacted with eyes emoji

@ghost

@NotYourTypicalDeveloper

@prabhu8511

@rohitdhas

it really works……………

@Pihu01

Will you please attach screenshot or write your issue which you are facing?
It will help me to understand related problem

@KabirSinghRana

Thanks, but It worked with the help of your previous answer.

@Prottoy2938

Didn’t work for me :(

Try doing «ctrl O» and then open the file. This will solve it. You might have seen «Not Opened In Folder» notification

@Geek2452

@eyobai

go to file>open folder> then open the folder where .html file is saved dont open the file just open the folder

Chloesnowzhang, kradd, devbluemoons, Fenix20033, FelixJose28, CarlosDez23, ntran35, 1BobC, arielbr, weysher, and 16 more reacted with thumbs up emoji
jy615 reacted with laugh emoji
YeloFx reacted with hooray emoji
AboSnehajit and nstzya reacted with heart emoji
TamarDvorkin, AboSnehajit, and nstzya reacted with rocket emoji

@Yashr29-max

Wow! I got the solution,
whenever you try to open file without opening folder in visual studio code, then the issue occurs, to avoid this first open the folder(where code file already exist) in visual studio code, and then you can open live server by right click.
thank you

sry but i cant understand please can you helped me to solved this prob…….

@Yashr29-max

Wow! I got the solution,
whenever you try to open file without opening folder in visual studio code, then the issue occurs, to avoid this first open the folder(where code file already exist) in visual studio code, and then you can open live server by right click.
thank you

thankyou pihu01 its working ……….
thanks alot….

@Tanmoy-Banerjee

I’m submitting a…

[ ] 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 -->
[X ] Feature request
[ X] Documentation issue or request
[ ] Other: <!-- Please describe: -->

Current behavior

With a HTML page open, I hit Ctrl+Shift+P and type Live Server: Open with Live Server but I get a error saying Open a folder or workspace… (File -> Open Folder)

Expected behavior

Should open a standalone HTML file.

Environment

Browser: 

- [ ] Chrome (desktop) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [X ] IE version 11
- [ ] Edge version XX

For Tooling issues:

- Live Server: Latest 
- Platform: Windows
- Visual Studio Code: 1.29.1

Others

Open your folder in Vscode explorer

@1999allen

the same question occured,can anybody help me figure it out ? 3q

@kradd

Vscode>File>Open folder >»choose the folder where you saved .html file.

then click on «alt+alt+o» to start live server.
i can make a short video if you cant understand me.

@1999allen

yep,i understand,i had try to find out folder,but it doesn’t work finally.I am so much appreciated if you could send me the video.

@lakhan-solanki

@Jacer7

I’m facing the same issue can anybody help me please!
«Open a folder or workspace… (File -> Open Folder)»

where are the solutions??

@arvinmi

Hi, I am facing the same issue. I tried opening in the folder location, and the folder in VS code explorer, it didn’t work. Can anyone help me out? Thanks in advance.

@1999allen

What a pity btw,i don’t know how to solve out the problem either.i am so soory for that,i am considering to download another editor such as Hbuilder replacing of vscode and let it go as for liverserver

Best Regards,
Allen

——————&nbsp;原始邮件&nbsp;——————
发件人:&nbsp;»arvinmi»<notifications@github.com&gt;;
发送时间:&nbsp;2020年5月25日(星期一) 下午2:20
收件人:&nbsp;»ritwickdey/vscode-live-server»<vscode-live-server@noreply.github.com&gt;;
抄送:&nbsp;»Allen»<53370387@qq.com&gt;;»Comment»<comment@noreply.github.com&gt;;
主题:&nbsp;Re: [ritwickdey/vscode-live-server] «Open a folder or workspace… (File -&gt; Open Folder)» when «&gt; Live Server: Open with Live Server» without a folder being open (#248)

Hi, I am facing the same issue. I tried opening in the folder location, and the folder in VS code explorer, it didn’t work. Can anyone help me out? Thanks in advance.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.

@HackerPractice

Wow! I got the solution,
whenever you try to open file without opening folder in visual studio code, then the issue occurs, to avoid this first open the folder(where code file already exist) in visual studio code, and then you can open live server by right click.
thank you

I cant believe that worked :D

@1999allen

i had try,but the error existed all the time.Do you have other solutions to aviod it?

Thank you so much~

Best Regards,
Allen

——————&nbsp;原始邮件&nbsp;——————
发件人: «HackerPractice»<notifications@github.com&gt;;
发送时间: 2020年5月31日(星期天) 晚上8:57
收件人: «ritwickdey/vscode-live-server»<vscode-live-server@noreply.github.com&gt;;
抄送: «Allen»<53370387@qq.com&gt;; «Comment»<comment@noreply.github.com&gt;;
主题: Re: [ritwickdey/vscode-live-server] &quot;Open a folder or workspace… (File -&gt; Open Folder)&quot; when &quot;&gt; Live Server: Open with Live Server&quot; without a folder being open (#248)

Wow! I got the solution,
whenever you try to open file without opening folder in visual studio code, then the issue occurs, to avoid this first open the folder(where code file already exist) in visual studio code, and then you can open live server by right click.
thank you

I cant believe that worked :D


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.

@aman-git13

Wow! I got the solution,
whenever you try to open file without opening folder in visual studio code, then the issue occurs, to avoid this first open the folder(where code file already exist) in visual studio code, and then you can open live server by right click.
thank you

thank you maam
it really works

@shahnaeem

Wow! I got the solution,
whenever you try to open file without opening folder in visual studio code, then the issue occurs, to avoid this first open the folder(where code file already exist) in visual studio code, and then you can open live server by right click.
thank you

thank you, it worked for me

@1999allen

thanks for your reminding,i am trying to do so but it doesn’t work at present,could you show me the pictures what you operate on?

thank you so much for your support.

Best Regards,
Allen

——————&nbsp;原始邮件&nbsp;——————
发件人: «shahnaeem»<notifications@github.com&gt;;
发送时间: 2020年6月22日(星期一) 凌晨5:28
收件人: «ritwickdey/vscode-live-server»<vscode-live-server@noreply.github.com&gt;;
抄送: «Allen»<53370387@qq.com&gt;; «Comment»<comment@noreply.github.com&gt;;
主题: Re: [ritwickdey/vscode-live-server] &quot;Open a folder or workspace… (File -&gt; Open Folder)&quot; when &quot;&gt; Live Server: Open with Live Server&quot; without a folder being open (#248)

Wow! I got the solution,
whenever you try to open file without opening folder in visual studio code, then the issue occurs, to avoid this first open the folder(where code file already exist) in visual studio code, and then you can open live server by right click.
thank you

thank you, it worked for me


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.

@loglost

well we should thanks to ‘Pihu01’ up there

@NiranjanShirke

Wow! I got the solution,
whenever you try to open file without opening folder in visual studio code, then the issue occurs, to avoid this first open the folder(where code file already exist) in visual studio code, and then you can open live server by right click.
thank you

It worked for me …thanks for posting

@nibicon

right click on UNTITLED (WORKSPACE) and select ADD FOLDER TO WORKSPACE
select the folder you wan to add and continue working.
Annotation 2020-11-21 095644
Annotation 2020-11-21 095634

@nibicon

you can also click on FILE and select ADD FOLDER TO WORKSPACE. then select the complete folder of your code.
Uploading {06AE5C49-1343-474D-AA51-6521DCFA1472}.png.jpg…

@Mohit-Rautela

Guyz…. its not working because you might have selected «open file» option to put your file in VS Code, instead try to select «open folder» option in VS Code and it will surely gonna work. 👍 💯 💯 💯 💯 💯 💯 💯 💯 💯 💯

@pechavarria62

For Apple users,
hi guys what worked for me it was, when i went to open the folder the system just took me right to the folder, i clicked out of there like were the folder is, then i went to the folder then the file, if the bottom line turns blue in vscode that means it worked. let me know please.

@kscripter

you can also click on FILE and select ADD FOLDER TO WORKSPACE. then select the complete folder of your code.

Exactly make sure all the folders you have your files in are saved in a «WORKSPACE FOLDER». Put all your files in the Workspace Folder, then open the files from your workspace folder by using VSCODE to open it.

@Lokesh01

Wow! I got the solution,
whenever you try to open file without opening folder in visual studio code, then the issue occurs, to avoid this first open the folder(where code file already exist) in visual studio code, and then you can open live server by right click.
thank you

thanx that really helped

@unisrasheed

I got a solution
open vs code
then click on files then click on open folder, select the folder where your html file is.
then click on right click open with server.
it will work

@lucasezequiel05

Wow! I got the solution,
whenever you try to open file without opening folder in visual studio code, then the issue occurs, to avoid this first open the folder(where code file already exist) in visual studio code, and then you can open live server by right click.
thank you

Thank you! I did it!

@premkr2512

go to File , Then to Open Folder and then go to Select . And now you can select your file .

@cmomodo

@ruvictor

Wow! I got the solution,
whenever you try to open file without opening folder in visual studio code, then the issue occurs, to avoid this first open the folder(where code file already exist) in visual studio code, and then you can open live server by right click.
thank you

Thanks! You are the best! :)

@sayma04

It worked for me. Thanks.

@dens90

thank you Pihu01
it works

@TamarDvorkin

eyobai

Thank you- it works!

@DevLGustavo

vá para arquivo>abrir pasta> depois abra a pasta onde o arquivo .html está salvo não abra o arquivo apenas abra a pasta

Consegui resolver com sua ajuda. grato!!!!!!!!!!!

@SeaSideSon

solution:
on VSC go to upper left: file>open folder
select the folder which contains the .html files
after that, the folder opens in VSC and you will be able to run the live server on each html file.

@JslinSir

Wow! I got the solution, whenever you try to open file without opening folder in visual studio code, then the issue occurs, to avoid this first open the folder(where code file already exist) in visual studio code, and then you can open live server by right click. thank you

6666

@SaarthakMaini

@EEvan11

«Open a folder or workspace… (File -> Open Folder)» when «> Live Server: Open with Live Server» without a folder being open» This issue happens to me too when I just create file in VS and just run it, so I just create some folder and put the file their and it works.

@LukaGK

@Mudassir551

Wow! I got the solution, whenever you try to open file without opening folder in visual studio code, then the issue occurs, to avoid this first open the folder(where code file already exist) in visual studio code, and then you can open live server by right click. thank you

Thanks!

@jalalbmnf

Hello everyone , i had a same issue. But i open html file in browser and open html file in vscode and it works , opening another folder or workspace is not a good way cause , machine spends power for unnecessary things when you unnecessary folder or workspace

@Hollin-A

Wow! I got the solution, whenever you try to open file without opening folder in visual studio code, then the issue occurs, to avoid this first open the folder(where code file already exist) in visual studio code, and then you can open live server by right click. thank you

Thank you. It worked

@dhritiman122

Wow! I got the solution, whenever you try to open file without opening folder in visual studio code, then the issue occurs, to avoid this first open the folder(where code file already exist) in visual studio code, and then you can open live server by right click. thank you

Thank you so much for your help

@NeelContractor

Probably you guys were use git and changed your working dir in it. first open your folder in which the file is save then try to do . this might help you guys.

@SIRBOLU

Wow! I got the solution, whenever you try to open file without opening folder in visual studio code, then the issue occurs, to avoid this first open the folder(where code file already exist) in visual studio code, and then you can open live server by right click. thank you

Thanks so much

@MauricioQuiroga

Guys hello, i have the same problem but i could not solve it. When i press Open with live server below message appears «Open a folder or workspace… (File -> Open Folder)», I opened any html file there many times but nothing about live server works ,guys how can i solve this?please any help Kind Regards

Guys hello, i have the same problem but i could not solve it. When i press Open with live server below message appears «Open a folder or workspace… (File -> Open Folder)», I opened any html file there many times but nothing about live server works ,guys how can i solve this?please any help Kind Regards

Solved it, turns out it’s you are using just one file of a folder instead of the folder in its entirety, I don’t know if I;m expressing myself correctly pero if this didn’t help let me know

VsCode uses live Server plug-in to report Open a folder or workspace… (File -> Open Folder) error

tags: jobs  vscode  front end  live Server  javascript

  • Bottom right cornerOpen a folder or workspace... (File -> Open Folder)The error is because the file is not opened in the folder

  • We open the folder and run the live Server plugin, and the service can be started normally at this time


  • Introduction to live Server

Intelligent Recommendation

Open the folder and select the file

C# open the folder to select the file 1. Code: 2. You can use cmd to verify normal operation. Enter in cmd: explorer.exe /select,“C:scdn_wuwt.txt” The effect is to open the Explorer to op…

More Recommendation

Интересно , могли бы вы помочь. Действительно сложно найти решение этой проблемы из моих исследований.

Я загрузил код Visual Studio две недели назад и обнаружил ошибку при отладке файла. Кажется, что файл открывается, но как только я запускаю отладчик, он показывает следующее:

‘${workspaceFolder}’ не может быть разрешен. Пожалуйста, откройте папку.

Кажется, не могу найти или воспроизвести подобное решение. Я также пытался переустановить код Visual Studio (нелегкий подвиг). Я пытаюсь хотя бы разобраться в проблеме и ее источнике.

Это файл.js, над которым я работал, выполняя простую функцию. Он не предназначен для работы в тандеме с большим рабочим пространством / программой.

2020-04-15 23:28

7
ответов

Решение

Если вы используете последнюю версию Visual Studio 1.44, обязательно обновитесь до 1.44.2.

Проблема microsoft/vscodeПроблема 94725 решена.
Там было то же сообщение об ошибке:

После некоторого исследования проблема заключается в следующем: для конфигурации рабочей области наши расширения отладки добавляют следующий атрибут

__workspaceFolder:'${workspaceFolder}'

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

Предлагаемое исправление: расширение узла, которое добавляет этот атрибут, должно охватывать его, если оно видит, что мы находимся в мультикорневой папке.
Так что вместо${workspaceFolder} использовать ${FOLDER_NAME:workspaceFolder}.

Это исправлено в фиксации ae97613.


user6309

18 апр ’20 в 09:08
2020-04-18 09:08

2020-04-18 09:08

В VScode перейдите в файл -> Добавить папку в рабочую область и выберите папку, в которой находятся файлы программы.

2021-01-31 00:40

Заменить ${workspaceFolder} с участием ${FOLDER_NAME:workspaceFolder} в твоем *.code-workspaceфайл. (из [здесь][1])

Кстати, то же самое касается ${workspaceRoot}, вы можете заменить его на ${FOLDER_NAME:workspaceRoot}.

Любые другие переменные папки могут быть исправлены этим FOLDER_NAME:префикс? Мои рабочие места пока ими не пользовались.

Работал у меня в Version: 1.44.2.

2020-04-30 21:40

Я знаю, что этот вопрос уже очень старый, и ответы, возможно, были правильными, но ни один из них не работал у меня на vscode v1.57.1 во время этого комментария 30.06.2021

Мне пришлось заменить
${workspaceFolder} с участием
${workspaceFolder:my-folder-name} в моем
*.code-workspace файл

Ссылка: переменные для каждой папки рабочей области

2021-06-30 16:11

У меня была такая же проблема, но я решил ее следующим образом:1- открыть VS Code от имени администратора 2- открыть лист 3- отладка без проблем :)



17 апр ’21 в 17:29
2021-04-17 17:29

2021-04-17 17:29

У меня недавно была эта проблема, и я прочитал ответы выше, но, будучи новичком, я не смог ее решить. В моем ответе у меня нет точного ответа, что вы должны делать, но я покажу, что сработало для меня.

  1. Зайдите в проводник, и вы увидите, что папка не добавлена.
  2. Найдите папку .vscode и выберите ее.
  3. Проблема решена {это, по крайней мере, сработало для меня. В нем **(. Vscode)** был файл с расширением .json}.



12 янв ’21 в 06:45
2021-01-12 06:45

2021-01-12 06:45

Понравилась статья? Поделить с друзьями:
  • Как можно найти ребенка в детском саду
  • Как найти окулаторию в скайриме
  • Фотошоп как исправить тон лица
  • Не найдешь как писать с мягким знаком
  • Как найти переписку по дате в инстаграме