mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-06-23 00:24:03 +08:00
fix(config): use standalone bundled Node for runtime compatibility checks
Standalone OpenClaw ships its own Node.js and openclaw.cmd prefers that binary over PATH. check_node() was inspecting the first system Node (often an older nvm install), marking compatible=false and blocking Gateway startup via ensure_node_runtime_compatible(). Prefer the bundled node next to the active standalone CLI when present, and mirror the same logic in dev-api web mode. Co-authored-by: 晴天 <1186258278@users.noreply.github.com>
This commit is contained in:
@@ -730,6 +730,13 @@ function decorateNodeDetection(base) {
|
||||
}
|
||||
}
|
||||
|
||||
function standaloneBundledNodePath(cliPath) {
|
||||
if (!cliPath) return null
|
||||
const dir = path.dirname(cliPath)
|
||||
const nodeBin = path.join(dir, isWindows ? 'node.exe' : 'node')
|
||||
return fs.existsSync(nodeBin) ? nodeBin : null
|
||||
}
|
||||
|
||||
function ensureNodeRuntimeCompatibleWeb() {
|
||||
const node = handlers.check_node()
|
||||
if (!node.installed) throw new Error('Node.js 未安装或未检测到,请先安装 Node.js 后重新检测')
|
||||
@@ -10851,6 +10858,19 @@ const handlers = {
|
||||
|
||||
check_node() {
|
||||
try {
|
||||
const cliPath = resolveOpenclawCliPath()
|
||||
if (cliPath && classifyCliSource(cliPath) === 'standalone') {
|
||||
const bundled = standaloneBundledNodePath(cliPath)
|
||||
if (bundled) {
|
||||
const ver = execSync(`"${bundled}" --version 2>&1`, { windowsHide: true }).toString().trim()
|
||||
return decorateNodeDetection({
|
||||
installed: true,
|
||||
version: ver,
|
||||
path: bundled,
|
||||
detectedFrom: 'standalone-bundled',
|
||||
})
|
||||
}
|
||||
}
|
||||
const ver = execSync('node --version 2>&1', { windowsHide: true }).toString().trim()
|
||||
return decorateNodeDetection({ installed: true, version: ver, path: findCommandPath('node') })
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user