ryan-williams / pnpm-transdep-issue

Repro: pnpm doesn't correctly install transitive dependencies:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pnpm-transdep-issue

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."


Github Actions repro

See this example run:

  • npm succeeds
  • pnpm 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.

Docker repro

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.
      

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.

About

Repro: pnpm doesn't correctly install transitive dependencies:


Languages

Language:Dockerfile 75.0%Language:TypeScript 25.0%