vscode
vscode copied to clipboard
Unable to rename folder when I open a file who call this same folder. [Error: EPERM: operation not permitted, rename...]
- VS Code Version: 1.78.2
- OS Version: Windows 11Professional 22H2
The only extension that I have installed is Tailwind CSS IntelliSense.
Here's a video that shows the bug, I'll try to explain it. : video
When I open VS Code and that no tabs are open, I can rename a folder with one or more folders/files inside it, no problem (but it doesn't give me a dialog box to update the imports.). However when I open a file where this folder is called, I am unable to rename it, it throws an error "Error: EPERM: operation not permitted, rename...".
Same thing if I open a file where the folder is called, close the file then try to rename it, it doesn't allow it. The only that "works" is -> close all the tabs, close VS code, re-open VS Code, rename the folder.
Any clues of where could this issue is coming from ? Thanks.
Edit : Still trying to search and this person on stackoverflow have exactly the same issue : https://stackoverflow.com/questions/74910451/vs-code-unable-to-rename-folder-on-windows-10-i-get-error-eperm-operation-no
A little update, I came back home, thinking that it may be Windows 11 (somehow...) but no, the same problem occurs with Windows 10 22H2 as well, unfortunaly.
Does it allow you to rename from the OS file explorer?
It doesn't allow me to rename it when VS Code access the project where this folder is located because "this folder is already open in another program" . But when VS Code is closed, yes, I can rename it without any issue.
Here's another video where I create the folders from scratch, if it helps to better visualize it https://www.youtube.com/watch?v=BwkmZ0o9ALk
I am facing this issue for the past month
Does this reproduce in the latest VS Code insiders build with all extensions disabled?
Does this reproduce in the latest VS Code insiders build with all extensions disabled?
Yes, just installed the latest VS Code insiders build and it is still happening but it usually happens after I start node in my root folder (npm run dev in my case), as soon as I stop node it works normally again.
Could you add more info about your script? Is it doing something with the files in your project?
It is a Next.js project, the script is the same when you create-next-app
is there any solutions? I literally formatted my pc and still get the same problem
Now this problem still exists. . . .
Basically, every file change (rename and delete) cannot be successful, which has seriously affected the work, qwq
I am still facing this issue
Also having this issue on a React Native project
Bump. issue still persists.
I faced this problem too, and I think it only occurs on Windows since the function works well on my Mac.
I'm also running into this problem, or maybe a different problem with the same error. After spending an hour or so trying to narrow it down, it seems that vs code doesn't like renaming or moving any directory tree that contains a git repository (even a fresh, empty repo). Attempting to do so results in the editor spinning for ~1 minute before giving up and showing the error (though mine is just a notification popup in the tray).
Some additional notes in no particular order:
- I didn't check any of the various git repository variations other than
mkdir test; cd test; git init - Closing vscode during the rename makes the rename succeed?
- Running 'git init' from outside vscode makes a folder which vscode refuses to move
- Running
git initfrom the vscode terminal (powershell) makes the folder unmoveable, but if you close and reopen the workspace, then the folder can now be moved? - Extensions don't seem to matter, the issue still presents when extensions are disabled
P.S. VSCode version is 1.82.2
@zdavidsen just a thought - what is your git.autofetch setting?
~Whatever the default is, I presume. git config git.autofetch returns nothing~
Oh you meant in vscode, whoops. git.autofetch is false
I think it is a duplicate of https://github.com/microsoft/TypeScript/issues/54087
The same issue would happen if you use Intellij also. Faced this issue today and neither VSCode nor Intellij cant move or rename folders. If you open Task Manager, and kill all node instances then renaming will work till VSCode or Intellij will spawn an instance of NodeJS.
I think this is related with Typescript server and not VSCode or Intellij.
Mine is win10, and it works for me when I run vscode as an administrator.
I terminated all node.exe and still can't rename a folder. @xeinebiu Besides, run vscode as an administrator not work for me.
https://github.com/microsoft/TypeScript/issues/54087#issuecomment-1616680385 I used this method to solve the problem.
Potential variation on this theme, I'm having trouble building WPF projects in Visual Studio if the folder is open in VSCode at the same time. Taking the suggestion from https://github.com/dotnet/wpf/issues/4299 to disable file watching in **/obj/** worked for me, but the relation to the file watcher made me think this issue may be related
Run vscode as an administrator and close any scripts which runs and serves your project and then rename .
It just helps to close VS Code and rename/move the folder in file-explorer. I'm on Win 11 and have the latest version of VS Code and i'm also facing these issues.
This has been an issue for years with vscode on Windows. I'm not sure it's fixable by vscode because it's a symptom of Windows's poor filesystem behavior (mac/linux never have this issue with their standard filesystems). However, vscode could do a better job of not just spinning for minutes waiting to do the operation which will just fail.
This will often not work if you're running an app server that holds a handle to your files/folders in the project. For example, a nextjs app. Killing those processes and then moving the folder will resolve it.
It's one of the most frustrating things about using vscode on windows, that's for sure.
This has been an issue for years with vscode on Windows. I'm not sure it's fixable by vscode because it's a symptom of Windows's poor filesystem behavior (mac/linux never have this issue with their standard filesystems). However, vscode could do a better job of not just spinning for minutes waiting to do the operation which will just fail.
This will often not work if you're running an app server that holds a handle to your files/folders in the project. For example, a nextjs app. Killing those processes and then moving the folder will resolve it.
It's one of the most frustrating things about using vscode on windows, that's for sure.
On Intellij, usually I just stop Typescript Language Service, move folders around then enable it back. Only one downside of it, references wont auto update when moving folders.
Hey @mjbvz, this issue might need further attention.
@CleverAxel, you can help us out by closing this issue if the problem no longer exists, or adding more information.
This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.
Happy Coding!