Computer use in CLI fails: @ant/computer-use-swift native module missing from npm package
Summary
Computer use in CLI (v2.1.88) fails with Cannot read properties of undefined (reading 'registerEscape'). The root cause is that the @ant/computer-use-swift native package is not included in the npm distribution.
Environment
- macOS Darwin 24.6.0 (Apple Silicon)
- Claude Code v2.1.88 (installed via npm/homebrew)
- Claude Desktop app installed and working (computer use works fine in Desktop)
- Pro plan, authenticated via claude.ai
- Ghostty terminal (also reproduced in Terminal.app)
- Screen Recording & Accessibility permissions granted
Steps to Reproduce
- Install Claude Code CLI v2.1.88
- Enable
computer-usevia/mcp - Ask Claude to take a screenshot or perform any computer use action
Error
Cannot read properties of undefined (reading 'registerEscape')
Root Cause Analysis
The CLI source (swiftLoader.ts) calls require('@ant/computer-use-swift') to load the native module. However:
@ant/computer-use-swiftdoes not exist in the CLI'snode_modules/- No
computer_use.nodebinary is bundled in the npm package - The only
.nodenative binaries shipped aresharp-darwin-arm64.nodeandaudio-capture.node
The native module does exist inside the Desktop app at:
/Applications/Claude.app/Contents/Resources/app.asar.unpacked/node_modules/@ant/claude-swift/build/Release/computer_use.node
And it loads fine when tested directly:
const m = require('/Applications/Claude.app/.../computer_use.node');
// m.computerUse.hotkey.registerEscape exists and works
The @ant/computer-use-swift/js/index.js supports a COMPUTER_USE_SWIFT_NODE_PATH env var override, but since the entire @ant/computer-use-swift package is missing from the CLI distribution, this codepath is never reached.
Expected Behavior
The @ant/computer-use-swift native module (or at minimum computer_use.node with its JS wrapper) should be included in the CLI npm package, or the CLI should locate it from the Desktop app installation.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗