Skip to content

[Bug]: FileNotFoundError: [WinError 2] when running hermes update on Windows (npm.cmd not resolved) #60742

Description

@EricNie-Git

Bug Description

Description:
When running hermes update on Windows, the update fails during the “Updating Node.js dependencies” step with the following error:
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

Steps to Reproduce

hermes update
⚕ Updating Hermes Agent...

→ Stopping Windows gateway process(es) before updating Hermes...
✓ Paused gateway profile(s): default
→ Discarded npm lockfile churn (1 file(s))
⚠ Updating from fork:
https://cnb.cool/hermesagent-cn/hermes-agent-cn-mirror.git

→ Fetching updates...
→ Local changes detected — stashing before update...
Saved working directory and index state On main: hermes-update-autostash-20260708-051232
→ Found 160 new commit(s)
✓ Pre-update snapshot: 20260708-051232-pre-update
→ Pulling updates...

⚠ Local changes were stashed before updating.
Restoring them may reapply local customizations onto the updated codebase.
Review the result afterward if Hermes behaves unexpectedly.
Restore local changes now? [Y/n]

→ Restoring local changes...
⚠ Local changes were restored on top of the updated codebase.
Review git diff / git status if Hermes behaves unexpectedly.
✓ Cleared 103 stale pycache directories

→ Fetching upstream...
✗ Failed to fetch upstream. Skipping upstream sync.
→ Updating Python dependencies...
✓ Managed uv updated (uv 0.11.28 (ebf0f43d7 2026-07-07 x86_64-pc-windows-msvc))
Using Python 3.11.15 environment at: venv
Resolved 99 packages in 2.21s
Built hermes-agent @ file:///E:/hermes/hermes-agent
Prepared 1 package in 4.49s
Uninstalled 1 package in 1ms
Installed 1 package in 33ms

  • hermes-agent==0.18.0 (from file:///E:/hermes/hermes-agent)
  • hermes-agent==0.18.2 (from file:///E:/hermes/hermes-agent)

→ Refreshing 19 active lazy backend(s)...
↑ 3 refreshed: platform.discord, tool.dashboard, tool.trace_upload
✓ 15 already current
· 1 skipped (unsupported on Windows: Matrix E2EE depends on python-olm, which has no Windows wheel and requires make + libolm to build from sdist. Run Hermes under WSL to use Matrix on Windows.): platform.matrix
→ Updating Node.js dependencies...
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "E:\hermes\hermes-agent\hermes_cli\main.py", line 14177, in
f"({describe_filters(filters)})."

File "E:\hermes\hermes-agent\hermes_cli\main.py", line 14171, in main
db.close()
^^^^^^^^^^^
File "E:\hermes\hermes-agent\hermes_cli\main.py", line 9303, in cmd_update
print(f"→ Current version: {version}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hermes\hermes-agent\hermes_cli\main.py", line 9915, in _cmd_update_impl
desktop_dir = PROJECT_ROOT / "apps" / "desktop"
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\hermes\hermes-agent\hermes_cli\main.py", line 8108, in _update_node_dependencies
if stderr:

File "E:\hermes\hermes-agent\hermes_cli\main.py", line 4794, in _run_npm_install_deterministic
if ci_result.returncode == 0:
^^^^^^^^^^^^^^^^^
File "C:\Users\NieQY\AppData\Roaming\uv\python\cpython-3.11-windows-x86_64-none\Lib\subprocess.py", line 548, in run
with Popen(*popenargs, **kwargs) as process:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\NieQY\AppData\Roaming\uv\python\cpython-3.11-windows-x86_64-none\Lib\subprocess.py", line 1026, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\NieQY\AppData\Roaming\uv\python\cpython-3.11-windows-x86_64-none\Lib\subprocess.py", line 1538, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

Expected Behavior

Root Cause:
In hermes_cli/main.py, the function _run_npm_install_deterministic calls subprocess.run([npm, "ci", ...]). On Windows, npm is actually npm.cmd. Python’s subprocess with shell=False cannot find npm.cmd when passed just the string "npm", leading to the WinError 2.

Actual Behavior

Root Cause:
In hermes_cli/main.py, the function _run_npm_install_deterministic calls subprocess.run([npm, "ci", ...]). On Windows, npm is actually npm.cmd. Python’s subprocess with shell=False cannot find npm.cmd when passed just the string "npm", leading to the WinError 2.

Affected Component

Setup / Installation

Messaging Platform (if gateway-related)

No response

Debug Report

Debug report uploaded:
  Report       https://paste.rs/LdJIW
  agent.log    https://paste.rs/nG4vE
  gateway.log  https://paste.rs/odU2M
  gui.log      https://paste.rs/eSoJO
  desktop.log  https://paste.rs/qTdIE

Operating System

windows11

Python Version

Python 3.11.15

Hermes Version

Hermes Agent v0.18.2 (2026.7.7.2) · upstream 9de9c25 Project: E:\hermes\hermes-agent Python: 3.11.15 OpenAI SDK: 2.24.0 Up to date

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

Root Cause:
In hermes_cli/main.py, the function _run_npm_install_deterministic calls subprocess.run([npm, "ci", ...]). On Windows, npm is actually npm.cmd. Python’s subprocess with shell=False cannot find npm.cmd when passed just the string "npm", leading to the WinError 2.

Proposed Fix (optional)

Suggested Fix:
Use shutil.which(npm) to resolve the full path (e.g., C:\nodejs\npm.cmd) before passing it to subprocess.run.

In _run_npm_install_deterministic:

npm_resolved = shutil.which(npm)
if npm_resolved:
npm = npm_resolved

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existsbugcomp/cliCLI entry point, hermes_cli/, setup wizardneeds-reproBug needs reproduction stepsplatform/windowsNative Windows-specific behavior or breakagesweeper:implemented-on-mainSweeper: behavior already present on current mainsweeper:risk-platform-windowsSweeper risk: may break or behave differently on native Windowstype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions