isaacs/rimraf

Fails to delete directory with a "not empty" error message v3.0.2

talmobi opened this issue · 2 comments

      rimraf.sync(p)

Fails to delete directory with a "not empty" error message, version 3.0.2 -- this used to work.

Updating to rimraf v4.1.0 works as expected without issue.

node:fs:1167
  return handleErrorFromBinding(ctx);
         ^

Error: ENOTEMPTY: directory not empty, rmdir '/var/folders/q3/cy_5dfcs1n5gy_v5l_px52b40000gn/T/puppeteer_dev_chrome_profile-DdPebw/Default/Cach
e/Cache_Data'
    at Object.rmdirSync (node:fs:1167:10)
    at rmkidsSync (/Users/mollie/code/twitch-webchat/node_modules/rimraf/rimraf.js:349:27)
    at rmdirSync (/Users/mollie/code/twitch-webchat/node_modules/rimraf/rimraf.js:329:7)
    at rimrafSync (/Users/mollie/code/twitch-webchat/node_modules/rimraf/rimraf.js:301:9)
    at /Users/mollie/code/twitch-webchat/node_modules/rimraf/rimraf.js:336:39
    at Array.forEach (<anonymous>)
    at rmkidsSync (/Users/mollie/code/twitch-webchat/node_modules/rimraf/rimraf.js:336:26)
    at rmdirSync (/Users/mollie/code/twitch-webchat/node_modules/rimraf/rimraf.js:329:7)
    at rimrafSync (/Users/mollie/code/twitch-webchat/node_modules/rimraf/rimraf.js:301:9)
    at /Users/mollie/code/twitch-webchat/node_modules/rimraf/rimraf.js:336:39 {
  errno: -66,
  syscall: 'rmdir',
  code: 'ENOTEMPTY',
  path: '/var/folders/q3/cy_5dfcs1n5gy_v5l_px52b40000gn/T/puppeteer_dev_chrome_profile-DdPebw/Default/Cache/Cache_Data'
}

A major part of the reason for the v4 rewrite was to work around that exact issue, I'm afraid. There's no way to backport it easily.

If you encounter it on v4, I can fix it, otherwise there's not much to be done about it.

Oh! This is not in windows, I misread.

Same answer, but less forcefully lol. If it works in v4, but not v3, it's probably not gonna be easy to fix. You can probably use node's built in fs.rm if you can't upgrade easily though.