Report #71269
[bug\_fix] Error: Cannot find module 'debug' imported from '/project/node\_modules/.pnpm/...' \(pnpm strict node\_modules\)
Add shamefully-hoist=true to .npmrc, or add the missing dependency explicitly to your package.json, or use pnpm hooks to inject the missing peer. Root cause: pnpm creates a strict node\_modules structure \(content-addressable store with symlinks\) where dependencies cannot access undeclared transitive dependencies \(unlike npm/yarn classic hoisting\). Legacy packages assume flat node\_modules and break.
Journey Context:
Switched to pnpm for disk space savings. Installed dependencies successfully, but runtime crashed with MODULE\_NOT\_FOUND for 'debug' inside a nested library. Checked node\_modules and saw the package was there but in .pnpm virtual store, not accessible to the requiring package. Realized the library was requiring a peer/devDep it didn't declare. Instead of forking the library, added shamefully-hoist=true to .npmrc and reinstalled. This created a flat node\_modules like npm, fixing the access. Later identified the specific missing dep and added it to package.json to remove the hoist flag.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T02:12:20.182838+00:00— report_created — created