From 6a0bf12bbb21649dc56cf8fa4d864c954085c797 Mon Sep 17 00:00:00 2001 From: abose Date: Sat, 10 Oct 2026 14:15:36 +0530 Subject: [PATCH] fix(windows): remove stale bundled Node dependencies before installation Clear the managed src-node tree before copying the new release so obsolete nested packages cannot override current dependencies during npm-based LSP setup. Abort installation if cleanup fails instead of launching a mixed dependency tree. Verified the compiled cleanup macro on Windows for fresh installs, upgrades with stale dependencies, reinstalls and locked-file failures. User data stayed intact. Full packaged upgrade verification remains pending on the preserved failing laptop. --- src-tauri/src/bundle/windows/nsis/installer.nsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src-tauri/src/bundle/windows/nsis/installer.nsi b/src-tauri/src/bundle/windows/nsis/installer.nsi index 480cecb7..80ae665c 100644 --- a/src-tauri/src/bundle/windows/nsis/installer.nsi +++ b/src-tauri/src/bundle/windows/nsis/installer.nsi @@ -1137,10 +1137,24 @@ Function SetupPhcode FunctionEnd +; Bundled dependencies are one release unit. Overlaying upgrades leaves removed nested +; packages on disk, where Node can resolve them instead of the new release's dependencies. +; Never defer this cleanup until reboot: that would allow a mixed dependency tree to launch. +!macro CleanBundledNodeResources + ${If} ${FileExists} "$INSTDIR\src-node\*.*" + ClearErrors + RMDir /r "$INSTDIR\src-node" + ${If} ${Errors} + Abort "$(unableToUninstall)" + ${EndIf} + ${EndIf} +!macroend + Section Install SetOutPath $INSTDIR !insertmacro CheckIfAppIsRunning + !insertmacro CleanBundledNodeResources ; Copy main executable File "${MAINBINARYSRCPATH}"