I was working with discord.js last night and I ran a few commands in the terminal. The last command I wrote caused the name of the file at the top of the screen to be crossed out and turn red and I followed the path to where the file was and it was gone. I've checked the recycling bin and nothing was there. The file has left no traces and the project is gone. Is there any way that I can get the code back?
The commands I ran were -
npm update,
npm audit,
npm audit fix (the one that caused the file to disappear)
My file was also within the node_modules folder which probably explains why it disappeared when I ran those.
Any help is appreciated, thanks.
Yes, apparently this happens sometimes, especially when there is update on restart (see here https://github.com/microsoft/vscode/issues/52855). For some reason the software is moved to
C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\_
where <user>
is your username.
If you run the code from that folder it goes as always. I didn't try any move or rename, just reinstalled the last version and everything went back to normal. This is first time happening to me, and according to most reports it doesn't happen often enough to be a problem, however a few users report it to have happened tens of time, that I understand being an annoyance.
EDIT: after two months from this answer, I have been experiencing the problem more and more often. What I noticed is that the problem seems to be originated by a failed automatic update, possibly in coincidence with some memory failure. It seems that an update is started, but then the program fails to complete it by moving files from temporary folder. SOLUTION: just run an update after the failure, you will get some issue with Ripgrep (rg.exe), ignore them and the software will be restored.
Also, I have found this thread Visual Studio Code updating woes, where it is suggested to disable option update.enableWindowsBackgroundUpdates
. I am giving it a try.
UPDATE: about four months after last edit, I can say it never happened again, at the point I even had forgotten the issue (there were some crashes during install due to other reason, but differently from before, they didn't make VScode disappear). Of course I cannot be sure if it was disabling the option, or a VScode updates which fixed the problem, but if you are experiencing this issue, I suggest you give it a try.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With