mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-06-25 17:54:10 +08:00
fix: npm install后误卸载新装包(current_source=unknown时old_pkg与new pkg相同)
This commit is contained in:
@@ -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 = []
|
||||
|
||||
@@ -3627,7 +3627,7 @@ async fn upgrade_openclaw_inner(
|
||||
// 切换源时需要卸载旧包,但为避免安装失败导致 CLI 丢失,
|
||||
// 先安装新包,成功后再卸载旧包
|
||||
let old_pkg = npm_package_name(¤t_source);
|
||||
let need_uninstall_old = current_source != source;
|
||||
let need_uninstall_old = current_source != source && old_pkg != pkg_name;
|
||||
|
||||
if requested_version.is_none() {
|
||||
if let Some(recommended) = &recommended_version {
|
||||
|
||||
Reference in New Issue
Block a user