Skip to content

fix: npm install -g from GitHub fails when devDependencies missing at prepare time #7

@thompsonson

Description

@thompsonson

Problem

npm install -g thompsonson/codeburn#<tag> fails with tsup: not found during the prepare lifecycle script.

npm error npm error command sh -c npm run build
npm error npm error > codeburn@0.9.1-thompsonson.1 build
npm error npm error > tsup
npm error npm error sh: 1: tsup: not found

Root Cause

npm install -g <github-url> only installs production dependencies before running prepare. DevDependencies (where tsup lives) are not installed at that point, so the build tool is missing.

This is general npm behaviour — not a codeburn bug — but it affects any package installed directly from GitHub with a build step.

Fix

Change prepare in package.json to use npx:

"prepare": "npx --yes tsup"

npx --yes downloads and runs tsup on the fly if not found. No dist in git, no registry publish needed.

Current workaround

PR #6 ships a pre-built dist/ in the repo. This works but is an anti-pattern (bloats git history, can go out of sync with source).

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions