fix spawn no node error

This commit is contained in:
beyondkmp 2025-09-23 21:34:51 +08:00
parent a54b49cc30
commit 6d8edc95d9
4 changed files with 5 additions and 50 deletions

View File

@ -1,18 +0,0 @@
diff --git a/sdk.mjs b/sdk.mjs
index e2dbafb4e2faa1bf2b6b02f0009a2b9bbf57c757..3f07a1d5c2949a246fe5414e69ab45942fa605a2 100644
--- a/sdk.mjs
+++ b/sdk.mjs
@@ -6355,11 +6355,11 @@ class ProcessTransport {
prompt,
additionalDirectories = [],
cwd,
- executable = isRunningWithBun() ? "bun" : "node",
+ executable = process.execPath,
executableArgs = [],
extraArgs = {},
pathToClaudeCodeExecutable,
- env = { ...process.env },
+ env = { ...process.env, ELECTRON_RUN_AS_NODE: '1' },
stderr,
customSystemPrompt,
appendSystemPrompt,

View File

@ -79,7 +79,7 @@
"release:aicore": "yarn workspace @cherrystudio/ai-core version patch --immediate && yarn workspace @cherrystudio/ai-core npm publish --access public" "release:aicore": "yarn workspace @cherrystudio/ai-core version patch --immediate && yarn workspace @cherrystudio/ai-core npm publish --access public"
}, },
"dependencies": { "dependencies": {
"@anthropic-ai/claude-code": "patch:@anthropic-ai/claude-code@npm%3A1.0.118#~/.yarn/patches/@anthropic-ai-claude-code-npm-1.0.118-bbf4e9e59f.patch", "@anthropic-ai/claude-code": "1.0.118",
"@libsql/client": "0.14.0", "@libsql/client": "0.14.0",
"@libsql/win32-x64-msvc": "^0.4.7", "@libsql/win32-x64-msvc": "^0.4.7",
"@napi-rs/system-ocr": "patch:@napi-rs/system-ocr@npm%3A1.0.2#~/.yarn/patches/@napi-rs-system-ocr-npm-1.0.2-59e7a78e8b.patch", "@napi-rs/system-ocr": "patch:@napi-rs/system-ocr@npm%3A1.0.2#~/.yarn/patches/@napi-rs-system-ocr-npm-1.0.2-59e7a78e8b.patch",

View File

@ -75,7 +75,8 @@ class ClaudeCodeService implements AgentServiceInterface {
...process.env, ...process.env,
ANTHROPIC_API_KEY: apiConfig.apiKey, ANTHROPIC_API_KEY: apiConfig.apiKey,
ANTHROPIC_BASE_URL: `http://${apiConfig.host}:${apiConfig.port}/${modelInfo.provider.id}`, ANTHROPIC_BASE_URL: `http://${apiConfig.host}:${apiConfig.port}/${modelInfo.provider.id}`,
ELECTRON_RUN_AS_NODE: '1' ELECTRON_RUN_AS_NODE: '1',
ELECTRON_NO_ATTACH_CONSOLE: '1'
} }
const errorChunks: string[] = [] const errorChunks: string[] = []
@ -86,6 +87,7 @@ class ClaudeCodeService implements AgentServiceInterface {
cwd, cwd,
env, env,
model: modelInfo.modelId, model: modelInfo.modelId,
executable: app.getPath('exe') as 'node' ,
pathToClaudeCodeExecutable: this.claudeExecutablePath, pathToClaudeCodeExecutable: this.claudeExecutablePath,
stderr: (chunk: string) => { stderr: (chunk: string) => {
logger.warn('claude stderr', { chunk }) logger.warn('claude stderr', { chunk })

View File

@ -414,35 +414,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@anthropic-ai/claude-code@patch:@anthropic-ai/claude-code@npm%3A1.0.118#~/.yarn/patches/@anthropic-ai-claude-code-npm-1.0.118-bbf4e9e59f.patch":
version: 1.0.118
resolution: "@anthropic-ai/claude-code@patch:@anthropic-ai/claude-code@npm%3A1.0.118#~/.yarn/patches/@anthropic-ai-claude-code-npm-1.0.118-bbf4e9e59f.patch::version=1.0.118&hash=d3554c"
dependencies:
"@img/sharp-darwin-arm64": "npm:^0.33.5"
"@img/sharp-darwin-x64": "npm:^0.33.5"
"@img/sharp-linux-arm": "npm:^0.33.5"
"@img/sharp-linux-arm64": "npm:^0.33.5"
"@img/sharp-linux-x64": "npm:^0.33.5"
"@img/sharp-win32-x64": "npm:^0.33.5"
dependenciesMeta:
"@img/sharp-darwin-arm64":
optional: true
"@img/sharp-darwin-x64":
optional: true
"@img/sharp-linux-arm":
optional: true
"@img/sharp-linux-arm64":
optional: true
"@img/sharp-linux-x64":
optional: true
"@img/sharp-win32-x64":
optional: true
bin:
claude: cli.js
checksum: 10c0/3d230f6e785e5c4fdcca30dc134ecaab09d1de11f020183b04bbd6b2cbc97593d2d9224a87a47546718d1795bd159be395a9af3f35ff3652e4b87804741223a1
languageName: node
linkType: hard
"@anthropic-ai/sdk@npm:>=0.50.3 <1": "@anthropic-ai/sdk@npm:>=0.50.3 <1":
version: 0.56.0 version: 0.56.0
resolution: "@anthropic-ai/sdk@npm:0.56.0" resolution: "@anthropic-ai/sdk@npm:0.56.0"
@ -14191,7 +14162,7 @@ __metadata:
"@ai-sdk/mistral": "npm:^2.0.14" "@ai-sdk/mistral": "npm:^2.0.14"
"@ai-sdk/perplexity": "npm:^2.0.9" "@ai-sdk/perplexity": "npm:^2.0.9"
"@ant-design/v5-patch-for-react-19": "npm:^1.0.3" "@ant-design/v5-patch-for-react-19": "npm:^1.0.3"
"@anthropic-ai/claude-code": "patch:@anthropic-ai/claude-code@npm%3A1.0.118#~/.yarn/patches/@anthropic-ai-claude-code-npm-1.0.118-bbf4e9e59f.patch" "@anthropic-ai/claude-code": "npm:1.0.118"
"@anthropic-ai/sdk": "npm:^0.41.0" "@anthropic-ai/sdk": "npm:^0.41.0"
"@anthropic-ai/vertex-sdk": "patch:@anthropic-ai/vertex-sdk@npm%3A0.11.4#~/.yarn/patches/@anthropic-ai-vertex-sdk-npm-0.11.4-c19cb41edb.patch" "@anthropic-ai/vertex-sdk": "patch:@anthropic-ai/vertex-sdk@npm%3A0.11.4#~/.yarn/patches/@anthropic-ai-vertex-sdk-npm-0.11.4-c19cb41edb.patch"
"@aws-sdk/client-bedrock": "npm:^3.840.0" "@aws-sdk/client-bedrock": "npm:^3.840.0"