Super strange thing just happened. In the middle of my project running, it crashed and I was left with this error:
Error: EPERM: operation not permitted, uv_cwd
at process.wrappedCwd [as cwd] (node:internal/bootstrap/switches/does_own_process_state:126:28)
...
All of the files on the lefthand side of the editor disappeared. Was just weird, so I closed VS Code and navigated to the folder and used the code .
shell command to open it up again as I normally would; however, this error again.
It literally came out of nowhere - I ran my program, got up to grab my coffee, came back 2 minutes later and was left with this. I have already tried:
npm cache clean
with the --force
flag.No luck though. Anyone have any ideas? I can't find anything online.
Edit:
It's happening again. I'm once again trying to run code .
within a project's directory in order to open it in VSCode. Here's the error's full stack trace:
Error: EPERM: operation not permitted, uv_cwd
at process.wrappedCwd [as cwd] (node:internal/bootstrap/switches/does_own_process_state:126:28)
at setupCurrentWorkingDirectory (/Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-node.js:1:155)
at Object.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-node.js:1:260)
at Module._compile (node:internal/modules/cjs/loader:1163:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1216:10)
at Module.load (node:internal/modules/cjs/loader:1035:32)
at Module._load (node:internal/modules/cjs/loader:876:12)
at Function.c._load (node:electron/js2c/asar_bundle:5:13343)
at Module.require (node:internal/modules/cjs/loader:1059:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/out/cli.js:1:97)
at Module._compile (node:internal/modules/cjs/loader:1163:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1216:10)
at Module.load (node:internal/modules/cjs/loader:1035:32)
at Module._load (node:internal/modules/cjs/loader:876:12)
at Function.c._load (node:electron/js2c/asar_bundle:5:13343)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47 {
errno: -1,
code: 'EPERM',
syscall: 'uv_cwd'
}
The project's folder (foo-bar
) lives in a folder called (let's say) FizzBuzz
on my desktop. From my desktop, I can run code FizzBuzz/foo-bar
and it'll open the project just file. The error above occurs when I try to run cd FizzBuzz/foo-bar && code .
It's a long shot, but since you're probably using MacOS, it could very well be related to an anti virus. Seems plausible for your case as it's coming completely out of the blue.
If you use &&
in bash, it spawns the process in a different way than using code .
standalone. So it's possibly flagged as dangerous only with &&
by anti virus, which might explain the difference you're observing in your edit.
Keep in mind that there is a chance you actually have a malicious package installed and it's rightly being picked up. A small chance, but malicious packages do exist on NPM. These recent discoveries might also have resulted in more anti virus rules and scanning of JS packages, which in turn make false positives more likely.
On a similar question there are also reports of this as a cause.
If it's not related to that, the question has plenty other answers you can try.
You didn't mention whether you tried rebooting. Since you updated the question saying "it's back", I assume it just stopped occurring previously. When did it do so? Was if after a reboot?