feat: Node.js path scanning + manual path input + git HTTPS auto-fix (v0.4.2)

- Add scan_node_paths: auto-scan C/D/E/F/G drives for Node.js installations
- Add check_node_at_path: verify Node.js at user-specified directory
- Add save_custom_node_path: persist custom path to ~/.openclaw/clawpanel.json
- enhanced_path() now loads saved custom path and applies to all commands
- Windows enhanced_path: scan Program Files, LOCALAPPDATA, APPDATA, common drives
- Auto git config HTTPS-instead-of-SSH before npm install (fixes exit 128)
- Setup page: auto-scan button + manual path input when Node.js not detected
- Error diagnosis: add EPERM, MODULE_NOT_FOUND, SSH publickey patterns
- README: expanded troubleshooting section
This commit is contained in:
晴天
2026-03-05 22:30:19 +08:00
parent b1b95e5a11
commit 6ca4267970
14 changed files with 382 additions and 42 deletions

View File

@@ -10,6 +10,15 @@
export function diagnoseInstallError(errStr) {
const s = errStr.toLowerCase()
// git SSH 权限问题(有 git 但没配 SSH Key
if (s.includes('permission denied (publickey)') || s.includes('ssh://git@github')) {
return {
title: '安装失败 — Git SSH 权限',
hint: '依赖包用了 SSH 协议拉取代码,但你没配 GitHub SSH Key。运行以下命令改用 HTTPS',
command: 'git config --global url."https://github.com/".insteadOf ssh://git@github.com/',
}
}
// git 未安装exit 128 + access rights
if (s.includes('code 128') || s.includes('exit 128') || s.includes('access rights')) {
return {
@@ -19,6 +28,24 @@ export function diagnoseInstallError(errStr) {
}
}
// EPERM文件被占用/权限问题)
if (s.includes('eperm') || s.includes('operation not permitted')) {
return {
title: '安装失败 — 文件被占用',
hint: '有文件被锁定无法写入。先关闭所有 ClawPanel 和 Node.js 进程,然后在管理员终端手动安装:',
command: 'npm install -g @qingchencloud/openclaw-zh --registry https://registry.npmmirror.com',
}
}
// MODULE_NOT_FOUND安装不完整
if (s.includes('module_not_found') || s.includes('cannot find module')) {
return {
title: '安装不完整',
hint: '上次安装可能中断了。先清理残留再重装:',
command: 'npm cache clean --force && npm install -g @qingchencloud/openclaw-zh --registry https://registry.npmmirror.com',
}
}
// ENOENT文件找不到
if (s.includes('enoent') || s.includes('-4058') || s.includes('code -4058')) {
return {

View File

@@ -287,6 +287,9 @@ export const api = {
// 安装/部署
checkInstallation: () => cachedInvoke('check_installation', {}, 60000),
checkNode: () => cachedInvoke('check_node', {}, 60000),
checkNodeAtPath: (nodeDir) => invoke('check_node_at_path', { node_dir: nodeDir }),
scanNodePaths: () => invoke('scan_node_paths'),
saveCustomNodePath: (nodeDir) => invoke('save_custom_node_path', { node_dir: nodeDir }),
getDeployConfig: () => cachedInvoke('get_deploy_config'),
patchModelVision: () => invoke('patch_model_vision'),
checkPanelUpdate: () => invoke('check_panel_update'),