Skip to content

vladadaba/pnpm-error-repro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reproduction

Run:

docker build --build-arg PROJECT_DIR=apps/example-app -t my-service .

fails with

 > [builder 9/9] RUN pnpm --filter "$(node -e "console.log(require('./package.json').name)")" --prod deploy /deploy:
0.353 Packages are copied from the content-addressable store to the virtual store.
0.353   Content-addressable store is at: /deploy/.pnpm-store/v10
0.353   Virtual store is at:             ../../../deploy/node_modules/.pnpm
0.355  WARN  Deployment with a shared lockfile has failed. If this is a bug, please report it at <https://github.com/pnpm/pnpm/issues>.
0.355 As a workaround, add the following to pnpm-workspace.yaml:
0.355
0.355   forceLegacyDeploy: true
0.390  ERR_PNPM_OUTDATED_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to date with <ROOT>/package.json
0.390
0.390 Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile"
0.390
0.390   Failure reason:
0.390   specifiers in the lockfile ({"@babel/traverse":"7.25.3","@nestjs/common":"11.1.2([email protected])([email protected])","@nestjs/core":"11.1.2(@nestjs/[email protected]([email protected])([email protected]))(@nestjs/[email protected])([email protected])([email protected])","@nestjs/platform-express":"11.1.2(@nestjs/[email protected]([email protected])([email protected]))(@nestjs/[email protected])","@react-native/js-polyfills":"0.74.84","@types/express-serve-static-core":"4.17.37","@xmldom/xmldom":"0.8.7","async":"3.2.2","axios":"1.9.0","babel-loader":"9.1.3(@babel/[email protected])([email protected](@swc/[email protected]))","body-parser":"1.20.3","cross-spawn":"7.0.5","decode-uri-component":"0.2.2","fast-xml-parser":"4.2.4","ip":"2.0.1","markdown-it":"13.0.2","minimist":"1.2.6","moment":"2.30.1","node-fetch":"2.6.11","parse-path":"5.0.0","parse-url":"6.0.1","plist":"3.0.4","react":"18.2.0","react-dom":"18.2.0([email protected])","reflect-metadata":"0.2.2","rxjs":"7.8.2","@eslint/eslintrc":"3.3.1","@eslint/js":"9.28.0","@nestjs/cli":"11.0.7(@swc/[email protected](@swc/[email protected])([email protected]))(@swc/[email protected])(@types/[email protected])","@nestjs/schematics":"11.0.5([email protected])([email protected])","@nestjs/testing":"11.1.2(@nestjs/[email protected]([email protected])([email protected]))(@nestjs/[email protected])(@nestjs/[email protected])","@swc/cli":"0.6.0(@swc/[email protected])([email protected])","@swc/core":"1.11.29","@types/express":"5.0.2","@types/jest":"29.5.14","@types/node":"22.15.29","@types/supertest":"6.0.3","eslint":"9.28.0","eslint-config-prettier":"10.1.5([email protected])","eslint-plugin-prettier":"5.4.1(@types/[email protected])([email protected]([email protected]))([email protected])([email protected])","globals":"16.2.0","jest":"29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))","prettier":"3.5.3","source-map-support":"0.5.21","supertest":"7.1.1","ts-jest":"29.3.4(@babel/[email protected])(@jest/[email protected])(@jest/[email protected])([email protected](@babel/[email protected]))([email protected](@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected])))([email protected])","ts-loader":"9.5.2([email protected])([email protected](@swc/[email protected]))","ts-node":"10.9.2(@swc/[email protected])(@types/[email protected])([email protected])","tsconfig-paths":"4.2.0","typescript":"5.8.3","typescript-eslint":"8.33.1([email protected])([email protected])"}) don't match specs in package.json ({"@eslint/eslintrc":"3.3.1","@eslint/js":"9.28.0","@nestjs/cli":"11.0.7(@swc/[email protected](@swc/[email protected])([email protected]))(@swc/[email protected])(@types/[email protected])","@nestjs/schematics":"11.0.5([email protected])([email protected])","@nestjs/testing":"11.1.2(@nestjs/[email protected]([email protected])([email protected]))(@nestjs/[email protected])(@nestjs/[email protected])","@swc/cli":"0.6.0(@swc/[email protected])([email protected])","@swc/core":"1.11.29","@types/express":"5.0.2","@types/jest":"29.5.14","@types/node":"22.15.29","@types/supertest":"6.0.3","eslint":"9.28.0","eslint-config-prettier":"10.1.5([email protected])","eslint-plugin-prettier":"5.4.1(@types/[email protected])([email protected]([email protected]))([email protected])([email protected])","globals":"16.2.0","jest":"29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))","prettier":"3.5.3","source-map-support":"0.5.21","supertest":"7.1.1","ts-jest":"29.3.4(@babel/[email protected])(@jest/[email protected])(@jest/[email protected])([email protected](@babel/[email protected]))([email protected](@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected])))([email protected])","ts-loader":"9.5.2([email protected])([email protected](@swc/[email protected]))","ts-node":"10.9.2(@swc/[email protected])(@types/[email protected])([email protected])","tsconfig-paths":"4.2.0","typescript":"5.8.3","typescript-eslint":"8.33.1([email protected])([email protected])","@babel/traverse":"7.25.3","@nestjs/common":"11.1.2([email protected])([email protected])","@nestjs/core":"11.1.2(@nestjs/[email protected]([email protected])([email protected]))(@nestjs/[email protected])([email protected])([email protected])","@nestjs/platform-express":"11.1.2(@nestjs/[email protected]([email protected])([email protected]))(@nestjs/[email protected])","@react-native/js-polyfills":"0.74.84","@types/express-serve-static-core":"4.17.37","@xmldom/xmldom":"0.8.7","async":"3.2.2","axios":"1.9.0","babel-loader":"9.1.3","body-parser":"1.20.3","cross-spawn":"7.0.5","decode-uri-component":"0.2.2","fast-xml-parser":"4.2.4","ip":"2.0.1","markdown-it":"13.0.2","minimist":"1.2.6","moment":"2.30.1","node-fetch":"2.6.11","parse-path":"5.0.0","parse-url":"6.0.1","plist":"3.0.4","react":"18.2.0","react-dom":"18.2.0","reflect-metadata":"0.2.2","rxjs":"7.8.2"})

Other behaviors

Comment out overrides in pnpm-lock.yaml

Re-run pnpm install to update pnpm-lock.yaml. Docker build is successful.

add --legacy flag to pnpm deploy in Dockerfile

Docker build is successful, but node_modules in final container is empty, so the app does not start (docker run --rm my-service) with this error:

node:internal/modules/cjs/loader:1228
  throw err;
  ^

Error: Cannot find module '@nestjs/core'
Require stack:
- /app/build/main.js
    at Function._resolveFilename (node:internal/modules/cjs/loader:1225:15)
    at Function._load (node:internal/modules/cjs/loader:1055:27)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:220:24)
    at Module.require (node:internal/modules/cjs/loader:1311:12)
    at require (node:internal/modules/helpers:136:16)
    at Object.<anonymous> (/app/build/main.js:3:16)
    at Module._compile (node:internal/modules/cjs/loader:1554:14)
    at Object..js (node:internal/modules/cjs/loader:1706:10)
    at Module.load (node:internal/modules/cjs/loader:1289:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/app/build/main.js' ]
}

Downgrade pnpm version and keep --legacy flag

10.11.0 is the last version where docker build is successful and the final container starts without error.

Running same commands on the host machine (MacOS)

rm -rf **/node_modules
rm -rf **/build
cd apps/example-app
pnpm --filter "$(node -e "console.log(require('./package.json').name)")" install --frozen-lockfile
pnpm build

# use `deploy` folder in monorepo root
pnpm --legacy --filter "$(node -e "console.log(require('./package.json').name)")" --prod deploy ../../deploy
cd ../..
node deploy/build/main.js

Build and application start work, but only with --legacy flag. Without it, same ERR_PNPM_OUTDATED_LOCKFILE error as before.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors