Skip to content

[Bug]: hermes update leaves stale @hermes/ink in node_modules, causing TUI SyntaxError on launch #16773

@ZYFsir

Description

@ZYFsir

Description

After running hermes update, launching the TUI with hermes --tui fails with:

file:///home/raspberry/.hermes/hermes-agent/ui-tui/dist/lib/memoryMonitor.js:1
import { evictInkCaches } from '@hermes/ink';
         ^^^^^^^^^^^^^^
SyntaxError: The requested module '@hermes/ink' does not provide an export named 'evictInkCaches'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:213:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:320:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:606:24)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5)

Node.js v20.20.2

Root Cause

The TUI declares @hermes/ink as a local file: dependency:

"@hermes/ink": "file:./packages/hermes-ink"

When npm resolves a file: dependency, it copies the source directory into node_modules/ at install time. Any subsequent changes to packages/hermes-ink/dist/ are invisible to the copy at node_modules/@hermes/ink/dist/.

The hermes update flow in _update_node_dependencies() (hermes_cli/main.py) runs npm install but does not rebuild @hermes/ink or re-sync its copy in node_modules/. This means:

  1. git pull fetches new source + new pre-built packages/hermes-ink/dist/ink-bundle.js
  2. npm install copies the files into node_modules/@hermes/ink/ — but since the copy was already present, npm may not update it, or it copies the old state depending on timing
  3. node_modules/@hermes/ink/dist/ink-bundle.js ends up stale, missing new exports like evictInkCaches
  4. The TUI dist/lib/memoryMonitor.js imports evictInkCaches from @hermes/ink → SyntaxError

Additionally, _tui_build_needed() does not detect the mismatch because both source and dist files from git share the same mtime (they were committed together), so it considers the build up-to-date and skips rebuilding.

Steps to Reproduce

  1. Install hermes and verify TUI works: hermes --tui
  2. Run hermes update (when an update is available that changes @hermes/ink exports)
  3. Run hermes --tui
  4. Observe the SyntaxError

Workaround

cd ~/.hermes/hermes-agent/ui-tui
npm run build
rm -rf node_modules/@hermes/ink
npm install

Suggested Fix

In _update_node_dependencies(), after a successful npm install for the ui-tui directory, add a step that:

  1. Rebuilds @hermes/ink: npm run build --prefix packages/hermes-ink
  2. Removes the stale copy: rm -rf node_modules/@hermes/ink
  3. Re-runs npm install to re-copy the freshly built dist

This ensures node_modules/@hermes/ink/ always reflects the latest build output after an update.

Environment

  • Hermes Agent v0.11.0 (2026.4.23)
  • Node.js v20.20.2, npm 9.2.0
  • OS: Linux (Debian, aarch64)
  • Python 3.11.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/cliCLI entry point, hermes_cli/, setup wizardcomp/tuiTerminal UI (ui-tui/ + tui_gateway/)type/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions