fix: resolve MODULE_NOT_FOUND on global npm install#70
Closed
Catafal wants to merge 2 commits intoCoastal-Programs:mainfrom
Closed
fix: resolve MODULE_NOT_FOUND on global npm install#70Catafal wants to merge 2 commits intoCoastal-Programs:mainfrom
Catafal wants to merge 2 commits intoCoastal-Programs:mainfrom
Conversation
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>
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
shxwith native Node.js inbuild,postpackscripts —shxis a devDependency unavailable duringnpm install -g, causing script failuresundiciandcli-table3to dependencies — both are imported at runtime (http-agent.ts,table-formatter.ts) but were listed as devDependencies, causingMODULE_NOT_FOUNDwhen any command runs|| truetoprepack— lets it fail gracefully in environments without devDepsnpm-shrinkwrap.jsonfromfilesarrayoclif.manifest.jsonso it always ships in the packageRoot Cause
When users run
npm install -g @coastal-programs/notion-cli, devDependencies are not installed. Two issues:build,postpack) depended onshx(a devDep)undiciandcli-table3(both devDeps)This caused
MODULE_NOT_FOUNDerrors both during installation and when running commands.Test plan
npm run buildpasses (noshxneeded)npm packsucceeds withoclif.manifest.jsonin tarballnpm install -g ./coastal-programs-notion-cli-5.9.0.tgzinstalls cleanlynotion-cli --versionworksnotion-cli doctorruns (no MODULE_NOT_FOUND)notion-cli listrenders table correctly (cli-table3 available)🤖 Generated with Claude Code