Vscode: [Error] ENOENT: no such file or directory, lstat 'C:\d'

Created on 8 Aug 2016  路  68Comments  路  Source: microsoft/vscode

  • VSCode Version: Code 1.4.0 (6276dcb0ae497766056b4c09ea75be1d76a8b679, 2016-08-04T16:45:31.680Z)
  • OS Version: Windows_NT ia32 6.1.7601

Steps to Reproduce:

  1. Yestoday I add a directory and use the git in vscode. Everything was OK.
  2. Today vscode reports this error after it is launched everytime.

Most helpful comment

Also please stop with "we don't support msys git" thing. MSYS2 is the major player when it comes to C/C++ in Windows after Visual Studio. Not supporting it is not a great idea.

All 68 comments

And the git panel just shows a progress bar looping forever.

Which folder do you have open in VS Code?

The only folder opened in VS Code was D:stm8iar1 with about 10 files in it.

git commands is in c:msys64usrbin.

I added c:msys64usrbin to system PATH.

Can you show me a screenshot of the error?

vscode_error2

vscode_error

No git process in task manager then.

Do you have any extensions installed?

I have only installed the following two extensions:
(1) c/c++ (0.8.1)
(2) Toggle Header/Source (0.1.2)

And do you get the same error when running code --disable-extensions?

Yes. The same error even after I uninstall the two extensions.

@bpasero There seems to be some confusion in which the user's workspace (D:\stm8\iar1) seems to be parsed in some way to make FS calls into C:\d... any idea?

@netjune would you be able to run vs code out of its sources so that we can do some instrumentation in the places where we call lstat?

@joaomoreno I do not understand where we call lstat in the renderer that could produce such a message, a quick search I could not find such.

Yes that beats me too. But errors from the ext host and shared proc both get propagated back, so it could come from anywhere.

@netjune can you also open the developer console (from help menu) to see if something gets logged?

@netjune would you be able to run vs code out of its sources so that we can do some instrumentation in the places where we call lstat?
I don't have enough time to try this now.

@netjune can you also open the developer console (from help menu) to see if something gets logged?
vscode_error3

@joaomoreno funky, looks like gitApp.js???

@netjune What git version do you have installed?

git version: 2.8.2

Can you try opening another folder? Maybe one inside C:? Do you get the same error?

Can you try opening another folder? Maybe one inside C:? Do you get the same error?

ENOENT: no such file or directory, lstat 'C:c'

Which folder did you try to open?

C:ti0730

Can you open some folder in your User home? For example C:\Users\joao\Desktop?

Can you open some folder in your User home? For example C:UsersjoaoDesktop?

ENOENT: no such file or directory, lstat 'C:d'

Does it reproduce with the latest Insiders release?

Does it reproduce with the latest Insiders release?

No. Same error as 1.4.0.

Do you have another machine you can try VS Code on?

Also, if you go to the command line and run git status from your folder, does it work?

I have a feeling your machine has a very strange setup somehow.

Yes, I use git in command line everyday. And git works well in visual studio 2015. Both on the same computer.

Maybe it is because I installed vscode of a new version upon a very old version. But I have removed and reinstalled it then, and it didn't help.

How to remove vscode cleanly?

Run the uninstaller, then also check for Visual Studio Code folders in %APPDATA%. And in your home directory, check for .vscode-* folders.

Also are you willing to do a live screen sharing chat where we can debug this together?

Run the uninstaller, then also check for Visual Studio Code folders in %APPDATA%. And in your home directory, check for .vscode-* folders.

I just found "Code - Insiders" in %APPDATA% and delete it. No .vscode-* in my home directory.
Then I reinstalled vscode and the error is the same.

Also are you willing to do a live screen sharing chat where we can debug this together?

Yes. Then what should I do?

Let me know your availability and I'll see when I can fit. We'll set up a time and I'll send you a conference call link.

Too busy the last saveral days. Sorry for the delayed reply.
I am available the the next 1~2 hours today. What about you?

I saw you joined but left right after.

Network problem. Google is hardly accessed in China.

Maybe I can make a screencast, and upload it to some place like www.youku.com. Is it usefull?

Please, yes.

Finally upload the screencast here: https://drive.google.com/file/d/0B3c99U0nm3QXUjJJaEU4TkJLbWM/view?usp=sharing

A picture of gif format.

I can create a git repo and use git function for the first time in vscode.
After reopenning the git repo folder, git function is not usable in vscode.

screencast: https://drive.google.com/file/d/0B3c99U0nm3QXcUtXUmZzWlV2Qjg/view?usp=sharing

Maybe vscode lost something of the project(folder) between saving and loading it?

Can you search your whole machine for all git.exe files? Maybe you have more than one git installed. What are the ones you find?

I searched my whole machine and found 2.
C:msys64usrbingit.exe
C:msys64usrlibgit-coregit.exe

I compared the two files. They have the same content.

In the vscode, a new git repo can always be created, and all git functions work well just BEFORE reopenning the same git repo folder.

When git function is not usable, I can close the current folder and create another git repo in the same vscode instance.

So git.exe can be found and properly used by vscode.

Hm... Can you try using the official git release and see whether it reproduces there? We don't support msys git.

@tapir Can you try with the official git instead of msys, which we don't support?

@joaomoreno I'll do you one better.

I've tried with the official git.exe by appointing the git.path to C:\\Program Files\\Git\\bin\\git.exe and it worked. Then I copied the mingw git.exe over to C:\\Program Files\\Git\\bin\\git.exe, restarted VSCode and it still worked!

So the problem is somehow with the path itself. Not the exe. For some reason it just doesn't like C:\\msys64\\usr\\bin\\git.exe

Might be much more than that since git uses many other tools that live in that path.

Closing as we don't support msys git.

I don't know what you mean. This is a VScode bug. Not MSYS2.
What if I were to install official Git in C:msys64 ? Because that's what I just did and it doesn't work.

I also copied mingw git.exe to any other path and again it worked. So it's not the git it self. It only happens when it's in msys64. And if some other thing in that path make it not work that's VSCode's bug because VSCode should only use git.exe and nothing else.

Also please stop with "we don't support msys git" thing. MSYS2 is the major player when it comes to C/C++ in Windows after Visual Studio. Not supporting it is not a great idea.

Reopening due to:

What if I were to install official Git in C:msys64 ? Because that's what I just did and it doesn't work.

I will install it in that path to confirm this.

We don't support msys git. But you are free to contribute a PR which makes it work.

If there is anything to support I will make a PR. But I really don't understand what you mean by that? How do you think both executables behave differently? To my understanding they work exactly the same way.

Also why should VSCode care about where the exe comes from?
It all seems pretty straight-forward to me. We have a "git.exe". Regardless of where it comes from if it works on terminal, it should work with VSCode.

I could not reproduce:

image

So it obviously doesn't have to do with _where the exe comes from_.

It is my understanding that they work the same way too. But clearly they don't. So someone needs to look into it. Since I don't even estimate 0.01% of our users using this version of git, I don't think it is wise to dedicate my time for it. So I suggest, if you feel passionate enough, to attempt to submit a PR.

Let's track that here: #13037

I have also this bug, but the git binary is the one bundled inside MSYS2.
It would be nice to use the MSYS2/MINGW64 Git executable instead of installing another MSYS2 instance.

I just opened Code and am experiencing exactly the same problem.

if you just don't want see the annoying warning and don't need the to use git inside vscode, just disable it.
// Place your settings in this file to overwrite the default settings { "git.enabled": false }
Also change git.path may also help, but I never find the git integration very useful (just personal taste) so I didn't give it a try.

And VSCode does not have any problem with both the old (msysgit) and new git for windows, which is a fork of msys2, and that's why they can't reproduce it. When you use the original msys2 and install git with pacman, VSCode will have trouble with git.

And if you just want to use git on windows, stick with git for windows, it has more friendly default settings and works well with most editor and IDEs, while for the raw msys2, sometimes you mess up with PATH and other environment variables.

I think vscode(or its dependant lib) has issue on handling code path, when using git from msys2 or cygwin.
For example:

  1. When project path is Z:proj, and
  2. git.exe in D:toolmsys64bin,
    vscode will apear error of "ENOENT: no such file or directory, lstat 'D:z'"

mklink /j "D:z" z: can resolve this, and then any other projects in z: or sub directory in z: like z:projectsproj1 will also benefit.

But if project path is in other partition, like E:porj, issue will apear again:"ENOENT: no such file or directory, lstat 'D:e'"
mklink /j "D:e" e: can resolve this.

Hope it can be fixed soon, why:

  1. It has been reported again and again by msys2 and cygwin users.
  2. Lots of them use Sublime/Emacs based on msys and cygwin to create cross platform web/c++/go/rust projects, they use package manager like pacman in msys2 to install(or update) mingw+clang+gdb+lldb+git+make, which support VCS greatly if they can keep consistent.
  3. Git for window includes another mingw, also is not inclueded in msys/cygwin toolchain or shell PATH.
  4. Sublime/Eclipse and its git plugins work well on both msys git or window git, it's not a Git issue, its an editor issue.

I was also experiencing this issue! lstat C:\home: No such file or directory would constantly pop up in the top of the editor window, and would reappear whenever I closed it. (I, as well, use Git for Windows/msysgit from the command line.) I ended up following @at15's advice and disabled git within vscode.

Does this help anyone? #4651

I didn't use windows too much, and even more rarely now . So I can't feedback. Waiting for others.

PS: I don't like the file path style of windows. It will be good if windows support path like: /c/some_dir/some_file.txt

Have the same bug and I don't use msysgit, I use cygwin64. If I have open in vscode my c:cygwin64home...git folder and then restart vscode, I will, after several seconds of waiting, see the ENOENT: no such file or directory, lstat 'C:home' error.

If I click on the "collapse" icon for the folder, I will see the same error message.
If I click on the Git icon on the left of vscode, I get the same error.

Cygwin is not yet supported #7998

Make sure that the .json file doesnt have a path to an invalid directory under files:

I had path pointing to
"path": "scripts", "addressable": true
"path": "sdk/scripts", "addressable": true

which I copy/pasted from a tutoria.
In fact I do not have Scripts folder under Home. Removing it packaged the project without errors.

It took some time to figure out, but the error description states what is missing. Please read it clearly and you can resolve on your own.

@joaomoreno #4651 solves it for me, might want to stick it somewhere in the official docs where crawlers will find it.

I'd like to add a few points.

1) I'm pretty sure that "I don't know, therefore msysgit" is not the proper approach to this issue.

2) This error is reproducible with zero Git involved. To me it occurs with go build.

Steps to reproduce:

1) Get a VM image for win10 15.15063 from modern.ie

2) start it up, install updates, restart

3) install vs code with defaults

4) install go runtime with defaults

5) start vs code

6) install go extension, restart vs code

7) create a new .go file:

~
package main
import "fmt"
func main() {
fmt.Println("foobar")
}
~

8) ctrl+f5

Expected output: foobar printed

Actual output:

~
The program "${file}" does not exist: Error: ENOENT: no such file or directory, lstat 'C:Program Files (x86)Microsoft VS Code${file}'
~

On the top the following appears:

~
Error: Failed to continue: "The program attribute must point to valid directory, .go file or executable."
~

Which you can either "close" or "open launch.json" but if you try the latter, nothing happens at all.

@bviktor This user's issue was indeed related to git. You have another issue, so can you please open a new issue? Ping me in it please.

Alright, #25138 opened.

Was this page helpful?
0 / 5 - 0 ratings