Commit 264ca87
fix(extension): Windows binary spawn must not depend on user-installed Node
Replaces the previous attempt (which assumed `node.exe` was on PATH —
true for devs, not for typical chat-IDE users) with a Node-independent
path that uses Cursor's bundled Electron runtime.
Mechanism: every Electron binary (Cursor.exe, Code.exe) can be invoked
as a plain Node interpreter by setting the env var
ELECTRON_RUN_AS_NODE=1. In the extension host `process.execPath` is the
absolute path to that Electron binary, so we always have it available.
This is the same pattern VS Code uses internally for language servers
and other Node subprocesses (vscode-languageclient,
vscode/extensions/typescript-language-features, etc.).
Three call surfaces fixed:
1. extension/src/spawn-binary.ts — used by search-mode toggle, backlog
add/update, setup, status webview, auditor auth. Replaces
`spawn("node", ...)` with `spawn(process.execPath, ...,
{ env: { ...process.env, ELECTRON_RUN_AS_NODE: "1" }})`.
2. extension/src/mcp-register.ts — the headline path. Registers MCP
with `command: process.execPath, env: { ELECTRON_RUN_AS_NODE: "1" }`
on Windows, so Cursor's MCP runner spawns Cursor.exe-as-Node when it
starts the AXME MCP server.
3. extension/src/hooks-install.ts — Cursor's hook runner spawns hook
commands via cmd.exe. We can't pass env vars through hooks.json
(the schema is just command/type/timeout). On Windows we now write
a tiny `~/.cursor/axme-hook.cmd` wrapper at install time that sets
ELECTRON_RUN_AS_NODE=1 + invokes Cursor.exe with the bundled binary
as argv[0]. hooks.json points at this wrapper. uninstallUserHooks()
deletes the wrapper alongside the JSON entries.
ELECTRON_RUN_AS_NODE behaviour is documented at:
https://www.electronjs.org/docs/latest/api/environment-variables#electron_run_as_node
Linux + macOS paths unchanged — shebang shim works natively.
Reported by @geobelsky after the v0.1.0 install failed silently on a
Windows machine without Node, leaving every MCP tool unreachable.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent a02e3ac commit 264ca87
3 files changed
Lines changed: 92 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
61 | 103 | | |
62 | 104 | | |
63 | 105 | | |
64 | 106 | | |
65 | 107 | | |
66 | 108 | | |
67 | 109 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
72 | 117 | | |
73 | | - | |
| 118 | + | |
| 119 | + | |
74 | 120 | | |
75 | 121 | | |
76 | 122 | | |
| |||
157 | 203 | | |
158 | 204 | | |
159 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
160 | 218 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
65 | 72 | | |
66 | | - | |
| 73 | + | |
67 | 74 | | |
| 75 | + | |
68 | 76 | | |
69 | 77 | | |
70 | | - | |
| 78 | + | |
71 | 79 | | |
72 | | - | |
| 80 | + | |
73 | 81 | | |
74 | 82 | | |
75 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
14 | 19 | | |
15 | 20 | | |
16 | 21 | | |
| |||
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
43 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
44 | 52 | | |
45 | 53 | | |
46 | 54 | | |
0 commit comments