Skip to content

Docker build fails on missing remark-math and rehype-katex dependency + pnpm build-script warning #11

Description

@Manveer-Pbx1

Environment

  • Deployment: Docker Compose, self-hosted on a VPS (added as an extra service alongside an existing nousresearch/hermes-agent container, not using the bundled docker-compose.yml)
  • Backend: existing hermes-agent gateway, OpenRouter provider, no Anthropic key configured
  • Build: via the provided Dockerfile

Problem 1: pnpm ignores native build scripts, breaks the build

Building the image with the Dockerfile's default pnpm install --no-frozen-lockfile fails with:

[ERR_PNPM_IGNORED_BUILDS] Ignored build scripts: better-sqlite3@12.8.0, esbuild@0.27.4, unrs-resolver@1.11.1 Run "pnpm approve-builds" to pick which dependencies should be allowed to run scripts. ​

followed by a hard failure (exit code 1) on the install step. This is pnpm 10+'s new default of refusing to auto-run postinstall/build scripts for packages like better-sqlite3 (a native module) unless explicitly approved. Since better-sqlite3 needs its native binary built to actually work, this isn't just a cosmetic warning — the app would likely be broken at runtime even if the build somehow succeeded.

Suggested fix: pin an older pnpm version, or add an explicit approval step before install:
dockerfile RUN npm install -g pnpm && pnpm approve-builds better-sqlite3 esbuild unrs-resolver && pnpm install --no-frozen-lockfile ​

Workaround used: switched the Dockerfile from pnpm install to npm install, which sidesteps this failure entirely.

Problem 2: Missing dependencies remark-math and rehype-katex

After working around Problem 1, the build still failed because remark-math and rehype-katex are used somewhere in the codebase (presumably for markdown math rendering) but aren't declared in package.json / the lockfile. Had to manually patch the Dockerfile to install them:

dockerfile RUN npm install remark-math rehype-katex ​

Suggested fix: add both packages to package.json dependencies and regenerate pnpm-lock.yaml.

Steps to reproduce

  1. git clone the repo on a fresh Linux VPS
  2. docker build using the provided Dockerfile (or docker compose build if added as a service)
  3. Build fails at the install step per Problem 1; after working around it, fails again per Problem 2

Suggested combined fix

  • Regenerate the lockfile with remark-math and rehype-katex included as explicit dependencies
  • Either downgrade the pinned pnpm version in the Dockerfile, or add pnpm approve-builds for the native-module packages before pnpm install, so a clean git clonedocker build works without manual Dockerfile edits

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions