Problem:
VS Code is unable to rename folders in JavaScript projects when this folder contains a file with an 'import' statement that imports a file from a subfolder.
Since this is a very common situation in js projects, this has become a very frequent problem.
When the issue manifests itself, I get the error:
Error: EPERM: operation not permitted, rename 'd:\project\parentFolder' -> 'd:\project\newName'
How to Make the Issue Manifest Itself:
The Setup:
Inside an empty project,
- Create a folder (parentFolder)
- Create a .js file inside the folder (parentFile.js)
- Create a subfolder inside the folder (childFolder)
- Create a .js file inside the subfolder (childFile.js)
- Import the child file from the parent file using JavaScript import statement
Getting the Issue
- Open the parentFile.js in VS Code
- Try to rename the parent folder
VS Code will hang, the bottom bar will say it's trying to rename the file, and after a while, the file won't be renamed and I get the error stated above.
If VS Code is reloaded and the parentFile.js is kept closed, the issue won't appear. But if it was opened once, even if the file is closed before renaming it, the issue will appear.
Relevant Info:
- Windows 10 (Dell Precision M6700)
- VS Code version 1.74.2 x64 (I tried both 'user' and 'system' install options)
- I tested removing all extensions and settings from VS Code
- I tested removing node.js from my machine
- I formatted my machine recently. I was having this issue before and I continue to have it after
Edit:
- I formatted my PC again, installed VS Code right away (and no other program) but the problem persists.
- I tried it on a different PC (win 10, Dell), and had the same issue.