pnpm doesn't install transitive dependencies (pnpm#7594)
Note: this is working as intended; see this comment on pnpm#7594, this explanation of pnpm's flat node_modules structure, and this explanation of pnpm's "strict" enforcement that packages references directly must be listed explicitly as package.json "dependencies."
See this example run:
npm
succeedspnpm
fails with error:deckgl-react.ts(1,20): error TS2307: Cannot find module '@deck.gl/react/typed' or its corresponding type declarations.
For some reason, pnpm install deck.gl
fails to install deck.gl's dependencies (original discussion: deck.gl#8456)
Also note that node_modules/@deck.gl
exists in the npm job but not in the pnpm job.
build() {
docker build --build-arg npm=$1 -t pnpm-transdep-issue --progress=plain .
}
build npm # ✅ works
build pnpm # ❌ fails
See Dockerfile:
- deck.gl depends on @deck.gl/react
npm install deck.gl
works as expected (installs@deck.gl/react
)pnpm install deck.gl
fails to install@deck.gl/react
- As a result, compiling deckgl-react.ts failes:
Cannot find module '@deck.gl/react/typed' or its corresponding type declarations.
- As a result, compiling deckgl-react.ts failes:
The build
command also runs ls -l node_modules
, and we see that the npm
version includes node_modules/@deck.gl/…
while the pnpm
version doesn't.