fix: npm install后误卸载新装包(current_source=unknown时old_pkg与new pkg相同)

This commit is contained in:
晴天
2026-04-11 05:26:27 +08:00
parent 2f33409a8b
commit d397de4c52
2 changed files with 2 additions and 2 deletions

View File

@@ -5444,7 +5444,7 @@ const handlers = {
const recommended = recommendedVersionFor(source)
const ver = version || recommended || 'latest'
const oldPkg = npmPackageName(currentSource)
const needUninstallOld = currentSource !== source
const needUninstallOld = currentSource !== source && oldPkg !== pkg
const npmBin = isWindows ? 'npm.cmd' : 'npm'
const registry = pickRegistryForPackage(pkg)
const logs = []