From d86c47f2d6d8ae1be73fc3f05ee588ba925f09ad Mon Sep 17 00:00:00 2001 From: Ashwin Bhat Date: Sun, 28 Sep 2025 15:16:40 -0700 Subject: [PATCH] refactor: remove unnecessary node installation check (#189) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplify CLI detection by removing redundant node installation check before throwing CLINotFoundError. 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude --- .../_internal/transport/subprocess_cli.py | 9 --------- tests/test_integration.py | 2 +- tests/test_transport.py | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/claude_agent_sdk/_internal/transport/subprocess_cli.py b/src/claude_agent_sdk/_internal/transport/subprocess_cli.py index 0e65618..567b32d 100644 --- a/src/claude_agent_sdk/_internal/transport/subprocess_cli.py +++ b/src/claude_agent_sdk/_internal/transport/subprocess_cli.py @@ -66,15 +66,6 @@ class SubprocessCLITransport(Transport): if path.exists() and path.is_file(): return str(path) - node_installed = shutil.which("node") is not None - - if not node_installed: - error_msg = "Claude Code requires Node.js, which is not installed.\n\n" - error_msg += "Install Node.js from: https://nodejs.org/\n" - error_msg += "\nAfter installing Node.js, install Claude Code:\n" - error_msg += " npm install -g @anthropic-ai/claude-code" - raise CLINotFoundError(error_msg) - raise CLINotFoundError( "Claude Code not found. Install with:\n" " npm install -g @anthropic-ai/claude-code\n" diff --git a/tests/test_integration.py b/tests/test_integration.py index 1afae61..8531c9e 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -161,7 +161,7 @@ class TestIntegration: async for _ in query(prompt="test"): pass - assert "Claude Code requires Node.js" in str(exc_info.value) + assert "Claude Code not found" in str(exc_info.value) anyio.run(_test) diff --git a/tests/test_transport.py b/tests/test_transport.py index 5a68c80..35641f6 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -25,7 +25,7 @@ class TestSubprocessCLITransport: ): SubprocessCLITransport(prompt="test", options=ClaudeAgentOptions()) - assert "Claude Code requires Node.js" in str(exc_info.value) + assert "Claude Code not found" in str(exc_info.value) def test_build_command_basic(self): """Test building basic CLI command."""