[PR #138] fix: resolve 'spawn node ENOENT' when SDK spawns claude CLI #138

Open
opened 2026-02-27 08:09:25 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/KeygraphHQ/shannon/pull/138
Author: @nitayStain
Created: 2/16/2026
Status: 🔄 Open

Base: mainHead: fix/sdk-spawn-enoent


📝 Commits (1)

  • 51a7acb fix: resolve 'spawn node ENOENT' when SDK spawns claude CLI

📊 Changes

2 files changed (+6 additions, -0 deletions)

View changed files

📝 Dockerfile (+3 -0)
📝 src/ai/claude-executor.ts (+3 -0)

📄 Description

Problem

The Claude Agent SDK fails with spawn node ENOENT when attempting to run any agent inside the Docker container.

Root Cause

Two issues:

  1. Missing CLI: The claude CLI (@anthropic-ai/claude-code) was not installed in the Docker image. The SDK's query() function spawns it as a subprocess.

  2. Stripped PATH: The env option passed to the SDK contained only ANTHROPIC_API_KEY and CLAUDE_CODE_MAX_OUTPUT_TOKENS. The SDK uses this as the complete environment for the spawned process, so PATH was missing and the claude script (#!/usr/bin/env node) couldn't locate node.

Fix

  • Dockerfile: Added npm install -g @anthropic-ai/claude-code to install the CLI.
  • claude-executor.ts: Spread process.env into sdkEnv so PATH and other system variables are inherited by the spawned process.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/KeygraphHQ/shannon/pull/138 **Author:** [@nitayStain](https://github.com/nitayStain) **Created:** 2/16/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/sdk-spawn-enoent` --- ### 📝 Commits (1) - [`51a7acb`](https://github.com/KeygraphHQ/shannon/commit/51a7acb490693f932c0b4817861e3846c047cb17) fix: resolve 'spawn node ENOENT' when SDK spawns claude CLI ### 📊 Changes **2 files changed** (+6 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `Dockerfile` (+3 -0) 📝 `src/ai/claude-executor.ts` (+3 -0) </details> ### 📄 Description ## Problem The Claude Agent SDK fails with `spawn node ENOENT` when attempting to run any agent inside the Docker container. ## Root Cause Two issues: 1. **Missing CLI**: The `claude` CLI (`@anthropic-ai/claude-code`) was not installed in the Docker image. The SDK's `query()` function spawns it as a subprocess. 2. **Stripped PATH**: The `env` option passed to the SDK contained only `ANTHROPIC_API_KEY` and `CLAUDE_CODE_MAX_OUTPUT_TOKENS`. The SDK uses this as the **complete** environment for the spawned process, so `PATH` was missing and the `claude` script (`#!/usr/bin/env node`) couldn't locate `node`. ## Fix - **Dockerfile**: Added `npm install -g @anthropic-ai/claude-code` to install the CLI. - **claude-executor.ts**: Spread `process.env` into `sdkEnv` so `PATH` and other system variables are inherited by the spawned process. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shannon-KeygraphHQ#138
No description provided.