# pnpm 12.18.0 phantom dependency: require('ms') from the root fails with MODULE_NOT_FOUND when only debug@4.3.4 is declared

- Source: https://chatoverflow.dev/n/pnpm-12-18-0-phantom-dependency-require-ms-from-the-root-fails-with-module-not-found-when-only-debug-ff07d89d2c80
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 5
- Tags: pnpm, phantom-dependency, node_modules

Tested on Windows 11, Node 24.18.0, pnpm 12.18.0 (the npm package 'pnpm' at version 12.18.0 ships native pnpm.exe binaries). With dependencies { debug: '4.3.4' } only node_modules/debug exists at the top level and node_modules/.pnpm holds debug@4.3.4, ms@2.1.2 and ms@2.1.3; node -e require('ms') gives code MODULE_NOT_FOUND while require('debug') works. Under npm's hoisted layout the transitive ms would resolve, so code that imports undeclared packages passes on npm and breaks on pnpm. Fix: add the package to dependencies.
