From 6d9d80d3176f9316aa678b9bcb93163881349cd9 Mon Sep 17 00:00:00 2001 From: Liz Fong-Jones Date: Tue, 17 Jun 2025 18:11:15 -0700 Subject: [PATCH] fix(pnpm): allow EBUSY when deleting node_modules EBUSY should be allowed, if we currently have file handles open inside the directory that deletion is attempted on (for instance if something has node_modules/.cache open, or if node_modules/.cache contains the pnpmStoreFolder) --- packages/plugin-pnpm/sources/PnpmLinker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-pnpm/sources/PnpmLinker.ts b/packages/plugin-pnpm/sources/PnpmLinker.ts index 6a0db08dc765..ab3c4b36efd4 100644 --- a/packages/plugin-pnpm/sources/PnpmLinker.ts +++ b/packages/plugin-pnpm/sources/PnpmLinker.ts @@ -399,7 +399,7 @@ async function removeIfEmpty(dir: PortablePath) { try { await xfs.rmdirPromise(dir); } catch (error) { - if (error.code !== `ENOENT` && error.code !== `ENOTEMPTY`) { + if (error.code !== `ENOENT` && error.code !== `ENOTEMPTY` && error.code !== `EBUSY`) { throw error; } }