Skip to content

Fresh install: plugin builds fail with ERR_MODULE_NOT_FOUND for workspace packages (@naap/plugin-build/dist/*, @naap/cache/dist/*) #129

@JJassonn69

Description

@JJassonn69

Description
On a fresh clone / fresh ./bin/start.sh, starting the platform or building plugin frontends can fail because internal workspace packages are imported from their compiled dist/ outputs, but those outputs are not built yet.

This shows up as Vite failing to load plugin vite.config.ts (which imports @naap/plugin-build/vite) and base-svc failing to start importing @naap/cache.

Environment

  • OS: Linux
  • Node: v23.11.1 (likely affects Node 20+ as well)
  • npm: 10.9.x

Steps to Reproduce

  1. Fresh clone repo
  2. Run ./bin/start.sh

Actual Behavior
Plugin frontend builds fail with missing module errors, e.g.:

failed to load config from .../plugins/marketplace/frontend/vite.config.ts
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../node_modules/@naap/plugin-build/dist/vite.js'

Also base-svccan fail with:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../node_modules/@naap/cache/dist/index.js'

Expected Behavior
Fresh install should be able to build plugins and start services without manually prebuilding internal workspace packages.

Workaround
Manually build the internal workspace packages first:

npm run build --workspace=@naap/plugin-build
npm run build --workspace=@naap/cache

After that, ./bin/start.sh proceeds and plugins build successfully.

Suspected Cause
Internal workspace packages packages/plugin-build, packages/cache publish exports/main pointing to dist/*, but there is no guaranteed bootstrap step (e.g. root postinstall / prepare / start script preflight) to compile them before they’re consumed by Vite/tsx.

Proposed Fix
Any of the following would resolve it:

  1. Add a root-level bootstrap step (recommended):
    • postinstall script that runs a minimal build for required internal packages:
      • npm run build --workspace=@naap/plugin-build
      • npm run build --workspace=@naap/cache
  2. Or update bin/start.sh preflight / plugin build checks to ensure these are built before attempting plugin builds / service startup.

Additional Notes

  • bin/build-plugins.sh already includes logic to build @naap/plugin-build if dist/vite.js is missing, but the failing path can happen outside that script (direct workspace builds / start flow).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions