Skip to content

Fresh worktrees miss hugo-apps/node_modules — Hugo build fails until cd hugo-apps && npm install #214

Description

@jung-thomas

Symptom

`npm run build:all` fails on a fresh git worktree because `hugo-apps/node_modules` doesn't exist. Root `npm install` populates the top-level dependencies, but `hugo-apps/` is its own npm project that needs its own `npm install` step.

Reproducer

```bash
git worktree add .worktrees/whatever -b some-branch
cd .worktrees/whatever
npm install # populates root node_modules
npm run fetch-tutorials # works
npm run build:all # FAILS — Hugo can't resolve @UI5 / vite-plugin-css-injected-by-js / etc.
```

The `hugo-apps/` build step inside `build:all` (Vite bundle for the Vue islands) needs its own dependency tree.

Why it matters

Multiple recurring failures during agent-driven implementation work (PR #197 navigator URL sync, PR #206 `/browse/` refactor) hit this. The recovery is always `cd hugo-apps && npm install` then retry, but it's invisible to the agent until the build fails. Memory pointer in CLAUDE plugin: `feedback-worktree-tests-hang` documents the symptom; this issue is for the underlying fix.

Proposed fixes (pick one or stack)

Option A — root postinstall

Add to root `package.json`:

```json
"scripts": {
"postinstall": "cd hugo-apps && npm install"
}
```

Runs automatically after every root `npm install`. Slight cost: every fresh `npm install` now takes longer. May want to gate on `hugo-apps/node_modules` absence to make it idempotent-cheap.

Option B — merge hugo-apps into the root workspace

Convert root `package.json` to use npm workspaces, with `hugo-apps` as one of the workspace members. Single `npm install` at the root resolves both dependency trees.

Risk: hugo-apps' `vite.config.ts` paths and the root scripts (`build:all`, etc.) might need adjustments. Larger change but the more correct long-term answer.

Option C — document in CLAUDE.md and the contributor guide

Add a note that fresh worktrees need `cd hugo-apps && npm install` after the root install. Minimum-cost solution but doesn't actually fix anything; just makes the workaround discoverable.

My recommendation

A for now (one-line script change, low risk, fixes the recurring agent friction). Revisit B if the workspaces refactor has other benefits.

Acceptance

  • A fresh worktree's `npm install && npm run build:all` succeeds without the manual `cd hugo-apps && npm install` step.
  • No regression to existing CI build (which works because CI runs both installs explicitly in the workflow YAML).

Out of scope

  • Restructuring the hugo-apps source tree.
  • Migrating away from Vite.

Activity

  1. added a commit that references this issue on Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions