From edff94294aa8e1bf1543535e0fd3f2e1c594940d Mon Sep 17 00:00:00 2001 From: SrGooglo Date: Wed, 3 Apr 2024 00:13:36 +0200 Subject: [PATCH] fix cached manifest fail --- packages/core/src/handlers/lastOperationRetry.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/core/src/handlers/lastOperationRetry.js b/packages/core/src/handlers/lastOperationRetry.js index 9da6b9b..93b632e 100644 --- a/packages/core/src/handlers/lastOperationRetry.js +++ b/packages/core/src/handlers/lastOperationRetry.js @@ -39,7 +39,11 @@ export default async function lastOperationRetry(pkg_id) { break case "failed": { // copy pkg.local_manifest to cache after uninstall - const cachedManifest = path.join(Vars.cache_path, path.basename(pkg.local_manifest)) + const cachedManifest = path.join(Vars.cache_path, `${Date.now()}${path.basename(pkg.local_manifest)}`) + + if (!fs.existsSync(Vars.cache_path)) { + await fs.promises.mkdir(Vars.cache_path, { recursive: true }) + } await fs.promises.copyFile(pkg.local_manifest, cachedManifest)