pnpm: As of pnpm@6.5.x node_modules is missing in workspace packages after running pnpm install in docker container

This issue is so bizarre. If I use pnpm@6.4.x in my Dockerfile, everything is fine, but with 6.5.x and 6.6.x, the node_modules directories are missing from my workspace package directories after running pnpm install once. If I run pnpm install a second time in the same RUN step, the directories are created.

The problem is reproducible building from a Dockerfile or from a running a docker container interactively. I thought this output from an interactive container might be useful (I noticed that the install scripts are not run on the first install, and 1 package seems to be missing?)

~/app $ pnpm i --frozen-lockfile
Scope: all 9 workspace projects
Using hooks from: /home/node/app/.pnpmfile.cjs
readPackage hook is declared. Manifests of dependencies might get overridden
Lockfile is up-to-date, resolution step is skipped
Packages: +2969
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

   ╭─────────────────────────────────────────────────────────────────╮
   │                                                                 │
   │                Update available! 6.5.0 → 6.6.1.                 │
   │   Changelog: https://github.com/pnpm/pnpm/releases/tag/v6.6.1   │
   │                 Run pnpm add -g pnpm to update.                 │
   │                                                                 │
   │     Follow @pnpmjs for updates: https://twitter.com/pnpmjs      │
   │                                                                 │
   ╰─────────────────────────────────────────────────────────────────╯

Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: /home/node/.pnpm-store/v3
  Virtual store is at:             node_modules/.pnpm
Downloading registry.npmjs.org/typescript/4.2.4: 10.4 MB/10.4 MB, done
Downloading registry.npmjs.org/aws-sdk/2.899.0: 7.6 MB/7.6 MB, done
Downloading registry.npmjs.org/typescript/3.9.9: 9.58 MB/9.58 MB, done
Progress: resolved 2969, reused 0, downloaded 2968, added 2968
~/app $ pnpm i --frozen-lockfile
Scope: all 9 workspace projects
Using hooks from: /home/node/app/.pnpmfile.cjs
readPackage hook is declared. Manifests of dependencies might get overridden
Lockfile is up-to-date, resolution step is skipped
Packages: +2969
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: /home/node/.pnpm-store/v3
  Virtual store is at:             node_modules/.pnpm
Progress: resolved 2969, reused 2968, downloaded 1, added 1, done
node_modules/.pnpm/core-js-pure@3.11.2/node_modules/core-js-pure: Running postinstall script, done in 114ms
node_modules/.pnpm/bcrypt@5.0.1_@types+node@14.14.43/node_modules/bcrypt: Running install script, done in 1s
node_modules/.pnpm/aws-sdk@2.899.0/node_modules/aws-sdk: Running postinstall script, done in 94ms
node_modules/.pnpm/aws-sdk@2.899.0_@types+node@14.14.43/node_modules/aws-sdk: Running postinstall script, done in 118ms
node_modules/.pnpm/core-js@2.6.12/node_modules/core-js: Running postinstall script, done in 69ms
node_modules/.pnpm/argon2@0.27.2_@types+node@14.14.43/node_modules/argon2: Running install script, done in 621ms
node_modules/.pnpm/core-js@3.11.2/node_modules/core-js: Running postinstall script, done in 80ms
node_modules/.pnpm/ejs@2.7.4/node_modules/ejs: Running postinstall script, done in 95ms
node_modules/.pnpm/hasura-cli@1.3.0_@types+node@14.14.43/node_modules/hasura-cli: Running postinstall script, done in 1s
node_modules/.pnpm/husky@4.3.8_@types+node@14.14.43/node_modules/husky: Running install script, done in 160ms
node_modules/.pnpm/node-sass@4.14.1_@types+node@12.20.11/node_modules/node-sass: Running install script, done in 1.2s
node_modules/.pnpm/husky@4.3.8_@types+node@14.14.43/node_modules/husky: Running postinstall script, done in 79ms
node_modules/.pnpm/nodemon@2.0.7_@types+node@14.14.43/node_modules/nodemon: Running postinstall script, done in 81ms
node_modules/.pnpm/argon2@0.27.2_@types+node@14.14.43/node_modules/argon2: Running postinstall script, done in 92ms
node_modules/.pnpm/node-sass@4.14.1_@types+node@12.20.11/node_modules/node-sass: Running postinstall script, done in 478ms

pnpm version: 6.5.x, 6.6.x

Code to reproduce the issue:

Dockerfile:

FROM node:fermium-alpine as npm-ci
# install tools needed to build native extensions
RUN : \
    && apk add -U python make g++ \
    && npm i -g pnpm@6.5.x \
    && mkdir -p /home/node/app/ \
    && chown node:node /home/node/app
USER node
WORKDIR /home/node/app
COPY --chown=node:node \
    .npmrc \
    pnpm-lock.yaml \
    pnpm-workspace.yaml \
    .pnpmfile.cjs \
    ./
COPY --chown=node:node \
    packages ./packages
# ok in pnpm@6.4.x, reproduces in 6.5.x and 6.6.x
RUN pnpm install --frozen-lockfile
# ok in pnpm 6.5.x and 6.6.x
RUN pnpm install --frozen-lockfile && pnpm install --frozen-lockfile

pnpm-workspace.yaml?

packages:
  - packages/*

Expected behavior:

packages/*/node_modules directories exist after running pnpm install --frozen-lockfile

Actual behavior:

package/*/node_modules directories are missing after running pnpm install --frozen-lockfile. Strangely, running pnpm install --frozen-lockfile a second time resolves the issue 😕

Additional information:

  • node -v prints: v14.17.0 (in container)
  • Windows, macOS, or Linux?: Docker desktop (for Mac) 3.3.3 Docker version 20.10.6, build 370c289

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (9 by maintainers)

Most upvoted comments

🚢 6.6.2