Skip to content

Fix tsx runtime dependency resolution#179

Open
0xble wants to merge 2 commits intotobi:mainfrom
0xble:fix/tsx-runtime-resolution
Open

Fix tsx runtime dependency resolution#179
0xble wants to merge 2 commits intotobi:mainfrom
0xble:fix/tsx-runtime-resolution

Conversation

@0xble
Copy link

@0xble 0xble commented Feb 15, 2026

Problem

The qmd wrapper script uses --import tsx with a bare specifier, which Node.js resolves relative to the current working directory instead of the package installation directory. This causes ERR_MODULE_NOT_FOUND errors when tsx is not installed globally.

Additionally, tsx is currently listed as a devDependency, but it's required at runtime by the wrapper script.

Solution

This PR implements the fix recommended by analyzing the issue:

  1. Move tsx to runtime dependencies - tsx is required at runtime, not just development
  2. Fix wrapper script tsx resolution - Added find_tsx_loader() function that searches up from the package installation directory to find node_modules/tsx/dist/loader.mjs, working with both nested and hoisted node_modules layouts
  3. Update documentation - Clarified in CLAUDE.md that:
    • Development can use Bun for package management and testing
    • Runtime requires Node.js >=22 due to better-sqlite3 incompatibility with Bun
    • The wrapper uses Node.js + tsx, not Bun

Changes

  • package.json: Moved tsx from devDependencies to dependencies
  • qmd wrapper: Added robust tsx loader resolution that works regardless of installation method
  • CLAUDE.md: Updated to clarify Node.js runtime requirement vs Bun development usage

Testing

After these changes, qmd will work correctly when installed via:

  • npm install -g @tobilu/qmd
  • bun install -g @tobilu/qmd

Without requiring a separate global tsx installation.

Fixes the ERR_MODULE_NOT_FOUND error reported by users installing qmd.

@JannikWempe
Copy link

qmd is currently broken for me because of the mentioned issue.

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.

2 participants