You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
On Windows the daemon's latest-version check runs npm's shell wrapper with node and fails at every start #1664
On Windows the daemon's latest-version check fails at every start:
{"level":"warn","module":"daemon.version-check","message":"Latest Simlock version check failed","fields":{"message":"C:\\Program Files\\nodejs\\npm:3\r\n# This is used by the Node.js installer, which expects the cygwin/mingw\r\n^\r\n\r\nSyntaxError: Invalid or unexpected token\r\n at wrapSafe (node:internal/modules/cjs/loader:1713:18)\r\n …\r\nNode.js v22.23.5"}}
Seen on Windows 11 23H2 with the official Node 22.23.5 installer, main at c9d82e3.
Why
NodeNpmCli (src/ports/npm-cli.ts:84) runs node on join(dirname(process.execPath), "npm"), which is C:\Program Files\nodejs\npm. On Windows that file is the POSIX shell wrapper the Node installer ships for Cygwin/MinGW, not JavaScript; npm's CLI script is node_modules\npm\bin\npm-cli.js beside it, and the shim to run is npm.cmd. simlock update installs through the same port, so it likely fails the same way.
Expected
The version check (and simlock update's npm call) works on Windows, or the check is skipped there with a clear reason instead of a stack trace every start.
Confirmed: a defect. src/ports/npm-cli.test.ts › "runs npm-cli.js from node_modules beside Node when npm there is the installer's shell wrapper" builds the Windows installer's layout (node, the shell wrapper npm, node_modules/npm/bin/npm-cli.js, no symlink) and runs view, install and globalRoot for real. All three fail with the reporter's error, so simlock update is hit too.
pnpm exec vitest run --project unit src/ports/npm-cli.test.ts
❯ src/ports/npm-cli.test.ts:102:22 expect(outcomes).toEqual(...)
- "ok": true,
+ "message": ".../nodejs/npm:3
+ # This is used by the Node.js installer, which expects the cygwin/mingw
+ SyntaxError: Invalid or unexpected token
Tests 1 failed | 3 passed (4)
I checked on a Windows 11 machine with Node 22.23.5 and read only. C:\Program Files\nodejs holds npm (bash), npm.cmd and node_modules\npm\bin\npm-cli.js. node.exe npm view simlock version fails as above. node.exe node_modules\npm\bin\npm-cli.js view simlock version prints 0.8.0.
Root cause
src/ports/npm-cli.ts:84 runs realpath(join(dirname(node), "npm")) as the script. On POSIX installs bin/npm is a symlink to lib/node_modules/npm/bin/npm-cli.js, so realpath finds the JavaScript. The Windows installer has no symlink there, and npm beside node.exe is a bash wrapper, so node parses bash as JavaScript. The daemon's version check (src/daemon/main.ts:311) and the updater (src/updater/main.ts:25) both build this port, so the symptom shows in both.
Simplest fix
In NodeNpmCli.#run, use join(dirname(node), "node_modules", "npm", "bin", "npm-cli.js") when filesystem.exists says it is there. Otherwise keep today's realpath of npm. No platform switch is needed, and no cmd.exe is involved.
fix applied, then: pnpm exec vitest run --project unit src/ports/npm-cli.test.ts src/ports/filesystem.test.ts \
src/updater/index.test.ts src/daemon/main-update.test.ts src/daemon/server-update.test.ts src/daemon/server-startup.test.ts
Test Files 6 passed (6) Tests 124 passed (124)
Alternatives rejected
Run npm.cmd: it needs cmd.exe and the %/" argument limits of windows-command.ts, for no gain.
Branch on process.platform === "win32": it needs a new option, and a Mac test could not drive it without one. The layout check covers the same installs.
Skip the check on Windows: npm works there, and simlock update would stay broken.
Risk
On Windows, npm i -g npm installs into %APPDATA%\npm, but simlock keeps running the npm bundled with Node. That npm still works.
Check that no POSIX install puts a node_modules/npm folder in Node's bin directory (Homebrew, nvm, the official .pkg).
Activity
V3RON commentedon Nov 17, 2026
Reproduction
Confirmed: a defect.
src/ports/npm-cli.test.ts› "runs npm-cli.js from node_modules beside Node when npm there is the installer's shell wrapper" builds the Windows installer's layout (node, the shell wrappernpm,node_modules/npm/bin/npm-cli.js, no symlink) and runsview,installandglobalRootfor real. All three fail with the reporter's error, sosimlock updateis hit too.I checked on a Windows 11 machine with Node 22.23.5 and read only.
C:\Program Files\nodejsholdsnpm(bash),npm.cmdandnode_modules\npm\bin\npm-cli.js.node.exe npm view simlock versionfails as above.node.exe node_modules\npm\bin\npm-cli.js view simlock versionprints0.8.0.Root cause
src/ports/npm-cli.ts:84runsrealpath(join(dirname(node), "npm"))as the script. On POSIX installsbin/npmis a symlink tolib/node_modules/npm/bin/npm-cli.js, so realpath finds the JavaScript. The Windows installer has no symlink there, andnpmbesidenode.exeis a bash wrapper, so node parses bash as JavaScript. The daemon's version check (src/daemon/main.ts:311) and the updater (src/updater/main.ts:25) both build this port, so the symptom shows in both.Simplest fix
In
NodeNpmCli.#run, usejoin(dirname(node), "node_modules", "npm", "bin", "npm-cli.js")whenfilesystem.existssays it is there. Otherwise keep today's realpath ofnpm. No platform switch is needed, and nocmd.exeis involved.Alternatives rejected
npm.cmd: it needscmd.exeand the%/"argument limits ofwindows-command.ts, for no gain.process.platform === "win32": it needs a new option, and a Mac test could not drive it without one. The layout check covers the same installs.simlock updatewould stay broken.Risk
npm i -g npminstalls into%APPDATA%\npm, but simlock keeps running the npm bundled with Node. That npm still works.node_modules/npmfolder in Node'sbindirectory (Homebrew, nvm, the official .pkg).Fast track
Written by an agent.
V3RON commentedon Nov 17, 2026
Delivery run
Merged: #1673 (#1664)
Parked: none
Waiting: none
Decided: none
Written by an agent.