Bug
package.json declares:
"postinstall": "node scripts/postinstall.mjs"
but scripts/ is not listed in the "files" whitelist, so scripts/postinstall.mjs is excluded from the published npm package. Every npm install of context-mode@1.0.75 (and earlier versions with this layout) fails with:
Error: Cannot find module '.../scripts/postinstall.mjs'
at Module._resolveFilename (node:internal/modules/cjs/loader:1475:15)
...
code: 'MODULE_NOT_FOUND'
Verification
- The file exists upstream on
main (HTTP 200 on raw.githubusercontent.com/mksglu/context-mode/main/scripts/postinstall.mjs)
- It is missing from the installed package at
.../context-mode/1.0.18/scripts/ (directory does not exist)
package.json "files" field contains ["build", "hooks", ...] — no scripts entry
Impact
- macOS / Linux: cosmetic — the script is essentially a no-op on these platforms (OpenClaw detection message + Windows-only junction fix), so the install still functions.
- Windows + nvm4w global install: functional regression — the nvm4w directory-junction fix in
postinstall.mjs never runs, so the context-mode.cmd shim can fail to resolve the package module path when npm prefix and node prefix are on different paths.
Reproduction
npm install -g context-mode@1.0.75
# → npm error command sh -c node scripts/postinstall.mjs
# → Error: Cannot find module '.../scripts/postinstall.mjs'
Also reproducible via the built-in upgrader:
node cli.bundle.mjs upgrade
# → "Update failed — GitHub pull failed — Cannot find module scripts/postinstall.mjs"
Fix
Add "scripts" to the files array in package.json:
"files": [
"build",
"hooks",
"scripts",
...
]
Alternatively, inline the postinstall logic into build/ output if keeping scripts/ out of the tarball is intentional.
Environment
context-mode@1.0.75
- Node.js v25.8.0
- macOS 25.3.0 (darwin-arm64)
- Claude Code plugin cache install path
Related
Bug
package.jsondeclares:but
scripts/is not listed in the"files"whitelist, soscripts/postinstall.mjsis excluded from the published npm package. Everynpm installofcontext-mode@1.0.75(and earlier versions with this layout) fails with:Verification
main(HTTP 200 onraw.githubusercontent.com/mksglu/context-mode/main/scripts/postinstall.mjs).../context-mode/1.0.18/scripts/(directory does not exist)package.json "files"field contains["build", "hooks", ...]— noscriptsentryImpact
postinstall.mjsnever runs, so thecontext-mode.cmdshim can fail to resolve the package module path when npm prefix and node prefix are on different paths.Reproduction
Also reproducible via the built-in upgrader:
Fix
Add
"scripts"to thefilesarray inpackage.json:Alternatively, inline the postinstall logic into
build/output if keepingscripts/out of the tarball is intentional.Environment
context-mode@1.0.75Related
postinstallscript changed incontext-mode@1.0.35#157 (that was about the postinstall content changing — security review). This is about the file being missing from the tarball entirely.ignore-scripts=true).