Skip to content

fix: resolve MODULE_NOT_FOUND on global npm install#70

Closed
Catafal wants to merge 2 commits intoCoastal-Programs:mainfrom
Catafal:fix/npm-packaging-module-not-found
Closed

fix: resolve MODULE_NOT_FOUND on global npm install#70
Catafal wants to merge 2 commits intoCoastal-Programs:mainfrom
Catafal:fix/npm-packaging-module-not-found

Conversation

@Catafal
Copy link

@Catafal Catafal commented Feb 20, 2026

Summary

  • Replace shx with native Node.js in build, postpack scripts — shx is a devDependency unavailable during npm install -g, causing script failures
  • Move undici and cli-table3 to dependencies — both are imported at runtime (http-agent.ts, table-formatter.ts) but were listed as devDependencies, causing MODULE_NOT_FOUND when any command runs
  • Add || true to prepack — lets it fail gracefully in environments without devDeps
  • Remove non-existent npm-shrinkwrap.json from files array
  • Commit oclif.manifest.json so it always ships in the package

Root Cause

When users run npm install -g @coastal-programs/notion-cli, devDependencies are not installed. Two issues:

  1. Lifecycle scripts (build, postpack) depended on shx (a devDep)
  2. Runtime code imported undici and cli-table3 (both devDeps)

This caused MODULE_NOT_FOUND errors both during installation and when running commands.

Test plan

  • npm run build passes (no shx needed)
  • npm pack succeeds with oclif.manifest.json in tarball
  • npm install -g ./coastal-programs-notion-cli-5.9.0.tgz installs cleanly
  • notion-cli --version works
  • notion-cli doctor runs (no MODULE_NOT_FOUND)
  • notion-cli list renders table correctly (cli-table3 available)

🤖 Generated with Claude Code

Catafal and others added 2 commits February 20, 2026 12:42
Build/prepack/postpack scripts used shx (a devDependency) which isn't
available during npm install -g, causing MODULE_NOT_FOUND errors.
Replaced with Node.js builtins (fs.rmSync, fs.unlinkSync), added
|| true to prepack for graceful failure, removed non-existent
npm-shrinkwrap.json from files array, and committed oclif.manifest.json
so it always ships in the package.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Both packages are imported at runtime (http-agent.ts and
table-formatter.ts) but were listed as devDependencies, causing
MODULE_NOT_FOUND when installed globally via npm install -g.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Catafal Catafal closed this by deleting the head repository Feb 20, 2026
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.

1 participant