vscode: Can't Install local user update due to `\\bin` folder being used by another process
There was an error while deleting a directory:
%LOCALAPPDATA%\Programs\Microsoft VS Code\bin
: the process cannot access the file because it is being used by another process…
- VSCode Version: 1.2.7.2 (user setup)
- OS Version: Windows 10
Steps to Reproduce:
- when an update is available, click Install Update
Does this issue occur when all extensions are disabled?: cannot try this because installation is disabled/destroyed due to incomplete setup
Workaround: will go back to system installs instead of local user installs.
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 37
- Comments: 97 (8 by maintainers)
OK. I was able to repro this in @sergiusignacius’s machine. Weirdly enough, it repros 100% of the time when Skype for Business is running. It doesn’t repro when Skype for Business isn’t running.
Any of you guys have Skype for Business?
Investigating…
I found what was causing it by more research, Have a look at antivirus protection software you may have and look for ransomware protection or exploit protection and temporarily disable them. As in my case, it was locking the folders to make sure viruses could not change or delete folders! All good now, hope it helps others!
Same issue here.
I’m not even able to delete
%LOCALAPPDATA%\Programs\Microsoft VS Code\bin
manually 😕Closing Outlook fixed it for me.
I confirm that when Skype was active then the update was failing leaving the user with no installation of VS Code (Insiders in my case). I confirm that terminating the Skype task from the task manager and doing the update works.
I agree with @euij , a failed tentative update shouldn’t leave the system with no installation of VS Code forcing one to download again the app from the website. These two steps should be decoupled and be able to deal differently.
Turning off Malware Bytes seems to solve this error as recommended by @81mark
Run into this issue several times recently, I don’t have Skype for Business installed, but have Skype app installed from Windows 10 Store.
Process Explorer shows
%LOCALAPPDATA%\Programs\Microsoft VS Code\bin
is used by system process.I found the following skype processes in Task Manager:
Terminate the first two didn’t help, until terminate the last one: SkypeBridge.exe, Process Explorer shows no process is using
%LOCALAPPDATA%\Programs\Microsoft VS Code\bin
anymore, then hit retry, VS Code successfully upgraded.Then reopen Skype app, Process Explorer shows
%LOCALAPPDATA%\Programs\Microsoft VS Code\bin
is used by system process again, terminateSkypeBridge.exe
in Task Manger, recheck in Process Explorer, no more processes usingbin
.It might be the virus scanner in my case as well, but this is an EVERY install/update PITA for me, too. For me … at least for this morning’s update … it’s the
resources
folder …… and the log file indicates …
I really, really wish a permanent fix could be made to the installer process to resolve this once and for all. 😩
This happens to me every time I close VS Code- it starts to update, fails, and then uninstalls VS Code. I have none of the previous programs mentioned that may interfere, and am on a Windows 10
As a workaround, feel free to disable background updates:
"update.enableWindowsBackgroundUpdates": false
. You’ll still get updates, just not in the background.Just want to say that there are actually two different problems here (but only tracked by this issue).
One could definitely hide the second problem by making sure that the update never fails. But that is probably not the right solution and I suspect that there should be another issue tracking the second problem.
It works!
Though I had to kill Skype for Business from the task manager as quitting wasn’t enough.
Having same issue every time VS Code gets an update. It tries to auto-update, fails, and corrupts itself and forces me to do a full manual uninstall/reinstall every time. Extremely frustrating.
[SOLVED] I had same issue, but with ‘\resources’ folder. What I did to solve was install IObit Unlocker Software and when the error happen, I use the IObit to unlock & delete the folder and than I “Retry” the update process. After this, another issue appears, but now says “can’t rename ‘code.exe’ file”, so I used IObit again to rename the ‘code.exe’ to ‘code.exe’ (same name, I don’t know why) and “Retry” again. Finally it’s works! Updated succesfully.
Shutting down f.lux solved this issue for me.
Killing Skype works for me
I have this error msg. I shutdown all Skype process and this work!
I was unable to update VS Code this morning and exiting f.lux (https://justgetflux.com/) allowed VS Code to update.
I have no Skype, Skype for Business or Teams open, but still can’t have bin removed.
I do
I don’t know what happened. But when I was re-installing after the code failed to install I choose install a system instead of user and that fixed the issue
wow @81mark, thanks for your advice. It actually worked for my machine !!. I tried different methods above but could not solve the issue. I turned off malware byte ransomware protection and exploit protection and it worked!
This is super frustrating… why hasn’t anyone mentioned “Citrix Workspace” ???!!! 😃
My Windows Process Explorer, like some other people have observed, displays only “System” as the process that owns the file handle to VS Code folder/files. That doesn’t help!
Through trial-and-error, it appears it’s
Citrix Workspace
. After I shutdown that application, I can delete the files/folderC:\Users\xxx\AppData\Local\Programs\Microsoft VS Code
.I was able to update after first closing Outlook. Looking at all the comments, seems office products are somehow blocking the process.
I wasn’t aware Skype moved to Electron (my company moved to Slack), but there are other apps like f.lux that aren’t Electron. The problem people have had seems to mostly be resolved by closing UWP apps.
Also, as another counterpoint, I have Slack installed as a “native” Electron app, installed normally (not from the store). It’s never caused this vscode issue. It’s Electron, but not UWP, but I’ve had UWP apps cause this locked file problem in vscode.
Personally I haven’t seen the issue at all since updating to Windows 1903
Moreover, it seems that when the failure happens, the update program doesn’t roll back the changes. I have to reinstall VSCode to the same location for continued usage.
Don’t have f.lux and skype. Just outlook and OneDrive. Killed both and I keep having the same problems. Any idea?? This is very annoying
This is very annoying.
Killing Skype did not work for me, however shutting down OneDrive did the trick.
Wow. I’ve had this problem for well over a year and can verify that closing f.lux (per @cbenard) on my laptop finally resolved this update issue for me.
Addendum: I noticed the same behavior with 1password - i.e. automatic updates of 1password.com failed because a file was being used by ‘another process’. Closing f.lux resolved that issue as well - so this problem sounds more like an issue with f.lux or programs like f.lux.
I’ve always had this issue on this Win10 install.
update.enableWindowsBackgroundUpdates
. Did not work.Code.exe
is locked.SkypeApp.exe
in task manager. Did not work.System
?I have f.lux installed, but I managed to update VS code finally after force quitting all Skype-related processes in Task Manager. (I don’t use Skype myself, but I haven’t removed it yet)
I have the same problem. Quit or kill Skype for Business not working.
@sergiusignacius Can reliably reproduce this. Will check with him asap.