From f0f0a63f6c7ab143c92da6626cb196d1d2cefd23 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 18 Dec 2025 12:09:52 +0100 Subject: [PATCH] Improve npm cache cleanup fallback logic Adds a fallback to manually remove the npm cache directory if 'npm cache clean --force' fails during cleanup. This ensures the cache is cleared even if the npm command encounters an error. --- misc/core.func | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/misc/core.func b/misc/core.func index d658d8efa..8bc8d5791 100644 --- a/misc/core.func +++ b/misc/core.func @@ -818,7 +818,10 @@ cleanup_lxc() { # Node.js npm if command -v npm &>/dev/null; then $STD npm cache verify 2>/dev/null || true - $STD npm cache clean --force 2>/dev/null || true + # Clean cache with fallback to manual removal if command fails + if ! $STD npm cache clean --force 2>/dev/null; then + rm -rf /root/.npm/_cacache 2>/dev/null || true + fi fi # Node.js yarn if command -v yarn &>/dev/null; then $STD yarn cache clean || true; fi