fix: add @clack/prompts transitive deps to fix npx installation#136
Merged
colbymchenry merged 2 commits intoMay 8, 2026
Merged
Conversation
When installed via `npx`, npm's flat node_modules cache fails to hoist ESM-only transitive dependencies from @clack/prompts → @clack/core. This causes: Cannot find package 'fast-wrap-ansi/index.js' imported from @clack/core/dist/index.mjs Adding fast-wrap-ansi, fast-string-width, and sisteransi as direct dependencies ensures they are resolved correctly in all installation contexts (npx, global, local). Reproduces on Node 24 + npm 11 with `npx @colbymchenry/codegraph@0.7.3`.
@clack/prompts@1.3.0 shipped with major bumps to its transitive deps (fast-wrap-ansi 0.1 → 0.2, fast-string-width 1 → 3). Promoting them at the older pins would have caused npm to install both sets side by side, defeating the dedup goal of this fix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
|
Thanks for the diagnosis — verified the npm hoisting issue is real and the transitive-deps were exactly as you identified. Pushed a follow-up commit to your branch bumping the pins to match |
jorgerobles
pushed a commit
to jorgerobles/codegraph
that referenced
this pull request
Jun 1, 2026
…ymchenry#136) * fix: add @clack/prompts transitive deps to fix npx installation When installed via `npx`, npm's flat node_modules cache fails to hoist ESM-only transitive dependencies from @clack/prompts → @clack/core. This causes: Cannot find package 'fast-wrap-ansi/index.js' imported from @clack/core/dist/index.mjs Adding fast-wrap-ansi, fast-string-width, and sisteransi as direct dependencies ensures they are resolved correctly in all installation contexts (npx, global, local). Reproduces on Node 24 + npm 11 with `npx @colbymchenry/codegraph@0.7.3`. * chore: bump @clack/prompts to 1.3.0 with matching transitive pins @clack/prompts@1.3.0 shipped with major bumps to its transitive deps (fast-wrap-ansi 0.1 → 0.2, fast-string-width 1 → 3). Promoting them at the older pins would have caused npm to install both sets side by side, defeating the dedup goal of this fix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: mfrancime <mfrancime@users.noreply.github.com> Co-authored-by: Colby McHenry <me@colbymchenry.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fast-wrap-ansi,fast-string-width, andsisteransias direct dependenciesProblem
When installed via
npx, npm's flatnode_modulescache fails to hoist ESM-only transitive dependencies from@clack/prompts→@clack/core. This causes:Reproduces on: Node 24.11.0 + npm 11.6.1 with
npx @colbymchenry/codegraph@0.7.3Root cause
@clack/core@1.2.0importsfast-wrap-ansi(ESM-only, noexportsmap, just"main": "lib/main.js"). In a normalnpm install, dependency hoisting putsfast-wrap-ansiin the top-levelnode_modules/. But in annpxcache directory, the flat structure sometimes fails to resolve these transitive ESM deps, causing aCannot find packageerror at runtime.Fix
Promote the three transitive dependencies (
fast-wrap-ansi,fast-string-width,sisteransi) to direct dependencies inpackage.json. This guarantees they're always installed at the top level regardless of installation method. These are already required at runtime — this just makes the dependency explicit.Test plan
npx @colbymchenry/codegraph --helpworks on Node 24 after clearing~/.npm/_npxnpm install -g @colbymchenry/codegraphstill works🤖 Generated with Claude Code