Linuxbrew/Node 25 Global Install Fix
Problem
On linuxbrew (Homebrew on Linux) with Node 25+, the global npm bin wrapper for qmd hardcodes a wrong path:
Error:
Error: Cannot find module '/home/linuxbrew/.linuxbrew/dist/cli/qmd.js'
Repro:
npm install -g @tobilu/qmd@2.0.0
qmd --version → MODULE_NOT_FOUND
Cause: npm generates bin/qmd as exec node '/home/linuxbrew/.linuxbrew/dist/cli/qmd.js' "$@", but actual module is in lib/node_modules/@tobilu/qmd/dist/cli/qmd.js (no dist/ symlink).
npx works fine.
Workaround
alias qmd='npx @tobilu/qmd@2.0.0'
Proposed Fix
Add this postinstall script to package.json:
{
"scripts": {
"postinstall": "node -e \"const fs = require('fs'); const prefix = require('npm-prefix')(); const binPath = `${prefix}/bin/qmd`; const modPath = `${prefix}/lib/node_modules/@tobilu/qmd/dist/cli/qmd.js`; const content = `#!/usr/bin/env node\\nrequire('${modPath}');`; fs.writeFileSync(binPath, content); fs.chmodSync(binPath, 0o755);\""
}
}
Linuxbrew/Node 25 Global Install Fix
Problem
On linuxbrew (Homebrew on Linux) with Node 25+, the global npm bin wrapper for qmd hardcodes a wrong path:
Error:
Repro:
npm install -g @tobilu/qmd@2.0.0qmd --version→ MODULE_NOT_FOUNDCause: npm generates bin/qmd as
exec node '/home/linuxbrew/.linuxbrew/dist/cli/qmd.js' "$@", but actual module is inlib/node_modules/@tobilu/qmd/dist/cli/qmd.js(no dist/ symlink).npx works fine.
Workaround
Proposed Fix
Add this postinstall script to package.json:
{ "scripts": { "postinstall": "node -e \"const fs = require('fs'); const prefix = require('npm-prefix')(); const binPath = `${prefix}/bin/qmd`; const modPath = `${prefix}/lib/node_modules/@tobilu/qmd/dist/cli/qmd.js`; const content = `#!/usr/bin/env node\\nrequire('${modPath}');`; fs.writeFileSync(binPath, content); fs.chmodSync(binPath, 0o755);\"" } }