nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.86k stars 2.38k forks source link

Broken PNPM Lock Files #16891

Closed wSedlacek closed 1 year ago

wSedlacek commented 1 year ago

Current Behavior

When building a project that generates a lock file with pnpm it comes out broken (when trying to install it errors like the following are reported)

WARN  Broken lockfile: no entry for '/debug/4.3.4(supports-color@8.1.1)' in pnpm-lock.yaml
ERR_PNPM_ERR_PNPM_LOCKFILE_MISSING_DEPENDENCY  The lockfile is broken! Resolution step will be performed to fix it.

Expected Behavior

Lockfiles should contain all references such that they are considered to be valid by pnpm

GitHub Repo

No response

Steps to Reproduce

  1. Build a project with a generated pnpm lockfile
  2. Copy the dist built to another directory (or docker image)
  3. pnpm install
  4. Observe the behavior

Note: Issue depends on dependency tree of that project.

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 18.13.0
   OS     : darwin arm64
   pnpm   : 8.4.0
   Hasher : Native

   nx (global)        : 16.1.3
   nx                 : 16.1.3
   @nx/js             : 16.1.3
   @nx/jest           : 16.1.3
   @nx/linter         : 16.1.3
   @nx/workspace      : 16.1.3
   @nx/angular        : 16.1.3
   @nx/cypress        : 16.1.3
   @nx/detox          : 16.1.3
   @nx/devkit         : 16.1.3
   @nx/eslint-plugin  : 16.1.3
   @nx/nest           : 16.1.3
   @nx/next           : 16.1.3
   @nx/node           : 16.1.3
   @nx/plugin         : 16.1.3
   @nx/react          : 16.1.3
   @nx/react-native   : 16.1.3
   @nx/web            : 16.1.3
   @nx/webpack        : 16.1.3
   typescript         : 5.0.4
   ---------------------------------------
   Community plugins:
   @jscutlery/semver        : 3.0.0
   @ngneat/spectator        : 14.0.0
   @ngrx/effects            : 16.0.0
   @ngrx/entity             : 16.0.0
   @ngrx/router-store       : 16.0.0
   @ngrx/schematics         : 16.0.0
   @ngrx/store              : 16.0.0
   @ngrx/store-devtools     : 16.0.0
   @nx-tools/nx-container   : 4.0.3
   @rx-angular/cdk          : 15.0.0
   @rx-angular/template     : 15.2.0
   eslint-config-rocketyard : 0.1.0
   eslint-plugin-ngrx       : 2.1.4
   ng-mocks                 : 14.10.0
   ngx-deploy-npm           : 5.2.0
   nx-stylelint             : 15.0.0
   ---------------------------------------
   Local workspace plugins:
         @rocketyard/file-storage-nx
         @rocketyard/redis-nx
         @rocketyard/nats-nx
         @rocketyard/github-nx
         @rocketyard/pg-nx
         @flagship-create/flagship-nx
         @rocketyard/orchestrate-nx
         eslint-config-rocketyard
         @rocketyard/terraform-nx

Failure Logs

No response

Operating System

Additional Information

This issue did not occur in 15

meeroslav commented 1 year ago

Thank you @wSedlacek for reporting the issue.

Can you provide a minimal reproduction repo, or at least the root pnpm-lock.yaml and resulting package.json so we can investigate what is happening?

In the meantime, can you try to remove node_modules and pnpm-lock.yaml and regenerate them with pnpm i just to make sure this is not a result of messed up packages?

wSedlacek commented 1 year ago

In the meantime, can you try to remove node_modules and pnpm-lock.yaml and regenerate them with pnpm i just to make sure this is not a result of messed up packages?

I have attempted this and I get the same results. I have also attempted to install the dependencies that report to be broken directly and with some of them they get fixed, but with others they don't. I have also tried enabling dedupe-peer-dependents=false as this changed between pnpm 7 and 8. This does cause different packages to be reported as missing in the lock file than without it.

Can you provide a minimal reproduction repo, or at least the root pnpm-lock.yaml and resulting package.json so we can investigate what is happening?

Here are the generated package.json and pnpm-lock.ymal output.zip When installing they give this error

#11 4.385  WARN  Broken lockfile: no entry for '/node-fetch/2.6.11(encoding@0.1.13)' in pnpm-lock.yaml
#11 4.388  ERR_PNPM_ERR_PNPM_LOCKFILE_MISSING_DEPENDENCY  The lockfile is broken! Resolution step will be performed to fix it.

It is generated from this lockfile pnpm-lock.yaml.zip

github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.