Skip to content

Commit d86c47f

Browse files
ashwin-antclaude
andauthored
refactor: remove unnecessary node installation check (#189)
Simplify CLI detection by removing redundant node installation check before throwing CLINotFoundError. 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude <[email protected]>
1 parent b3656b1 commit d86c47f

File tree

3 files changed

+2
-11
lines changed

3 files changed

+2
-11
lines changed

src/claude_agent_sdk/_internal/transport/subprocess_cli.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,6 @@ def _find_cli(self) -> str:
6666
if path.exists() and path.is_file():
6767
return str(path)
6868

69-
node_installed = shutil.which("node") is not None
70-
71-
if not node_installed:
72-
error_msg = "Claude Code requires Node.js, which is not installed.\n\n"
73-
error_msg += "Install Node.js from: https://nodejs.org/\n"
74-
error_msg += "\nAfter installing Node.js, install Claude Code:\n"
75-
error_msg += " npm install -g @anthropic-ai/claude-code"
76-
raise CLINotFoundError(error_msg)
77-
7869
raise CLINotFoundError(
7970
"Claude Code not found. Install with:\n"
8071
" npm install -g @anthropic-ai/claude-code\n"

tests/test_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ async def _test():
161161
async for _ in query(prompt="test"):
162162
pass
163163

164-
assert "Claude Code requires Node.js" in str(exc_info.value)
164+
assert "Claude Code not found" in str(exc_info.value)
165165

166166
anyio.run(_test)
167167

tests/test_transport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test_find_cli_not_found(self):
2525
):
2626
SubprocessCLITransport(prompt="test", options=ClaudeAgentOptions())
2727

28-
assert "Claude Code requires Node.js" in str(exc_info.value)
28+
assert "Claude Code not found" in str(exc_info.value)
2929

3030
def test_build_command_basic(self):
3131
"""Test building basic CLI command."""

0 commit comments

Comments
 (0)