Skip to content

fix: declare yaml as a root dependency so global installs work (#109) - #110

Open
gitsacha wants to merge 3 commits into
Lex-Inc:mainfrom
gitsacha:fix/missing-yaml-runtime-dep
Open

gitsacha wants to merge 3 commits into
Lex-Inc:mainfrom
gitsacha:fix/missing-yaml-runtime-dep

Conversation

@gitsacha

@gitsacha gitsacha commented Jun 1, 2026 •

Copy link
Copy Markdown

Summary

Fixes #109 — after a fresh npm i -g roughdraft, every command crashes with:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'yaml' imported from
.../roughdraft/packages/rfm/dist/index.js

Root cause

@roughdraft/rfm's published dist/index.js does a runtime import 'yaml' in Node. yaml is declared as a dependency of the private @roughdraft/rfm workspace package, but the root package.json (what users install) only lists @roughdraft/rfm (via file:packages/rfm) and express. The root files whitelist ships packages/rfm/dist as raw, unbundled code, so its runtime imports are resolved from the installed package's node_modules — but yaml is never there, because it isn't declared in the manifest npm installs. The CLI is unusable.

(packages/app also imports yaml, but that's bundled into its browser build, so it's unaffected — this only bites the Node-resolved rfm runtime import.)

Fix

Promote yaml to the root dependencies (matching rfm's ^2.9.0 range). npm then installs yaml into the package's node_modules, where Node resolves it by walking up from packages/rfm/dist. This makes the documented #109 workaround permanent. Lockfile updated to add yaml to the root importer (the yaml@2.9.0 snapshot was already present transitively).

Following the repo Bug Fix Workflow ("Prove It")

  1. Reproduce first: packages/server/src/packaging.test.ts asserts every runtime dependency of @roughdraft/rfm is declared in the root package.json. It fails on the missing yaml before the promotion and passes after — a behavioral guard for the whole class of "transitive workspace runtime dep not promoted to the published manifest", not just yaml.
  2. Fix: promote yaml to the root manifest.
  3. Verify: test passes; full gate green (below).

Verification

Ran the full CI gate locally with pnpm 10 (matching ci.yml's pnpm/action-setup@v4 version: 10):

  • ✅ pnpm install --frozen-lockfile — accepts the lockfile edit; installs yaml 2.9.0 at the root.
  • ✅ pnpm check — exit 0 (biome lint + test:selectors + vitest across all 5 workspace projects + build).
  • ✅ New packaging.test.ts passes; confirmed it fails without the dependency promotion.
  • ✅ Reproduced the original crash on a real global install and confirmed the fix resolves it.

@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown

@gitsacha is attempting to deploy a commit to the Lex Team on Vercel.

A member of the Team first needs to authorize it.

The rfm package's published dist/index.js does a runtime `import 'yaml'`,
but `yaml` was only declared in the private @roughdraft/rfm workspace
package. It was never promoted to the root package.json, so `npm i -g
roughdraft` never installs it and every command crashes with
ERR_MODULE_NOT_FOUND for 'yaml'.

Promote `yaml` to the root dependencies so npm installs it into the
package's node_modules, where Node resolves it by walking up from
packages/rfm/dist. This matches the documented workaround in Lex-Inc#109.

Fixes Lex-Inc#109
Regression test for Lex-Inc#109. @roughdraft/rfm ships as raw dist whose runtime
imports are resolved from the installed package, so any runtime dep rfm
declares must also live in the root package.json or a global install
crashes with ERR_MODULE_NOT_FOUND. Fails on the missing 'yaml' before the
dependency promotion, passes after.
@gitsacha
gitsacha force-pushed the fix/missing-yaml-runtime-dep branch from f6f633d to ef1a119 Compare August 12, 2026 20:23
@gitsacha

Copy link
Copy Markdown
Author

Rebased onto current main (686919e) — still applies clean, no conflicts. Happy to address feedback if there's anything you'd like changed; otherwise this is ready whenever you get a chance to look.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

roughdraft crashes on every command: missing yaml dependency not installed (ERR_MODULE_NOT_FOUND)

1 participant