Skip to content

Pruned lock file creation failed  #27571

Open
@robert14k

Description

@robert14k

Current Behavior

I am upgrading from nx 16.7.4 to 19 and noticed that any version above 16.7.4 is causing the same issue for me. When I get all of the dependancies in check and install everything, I then run a build or serve of a firebase application which causes nx to return a pruned lock file error. I have tried this will NX 16.8.0, 17.x, 18.x and now 19.x and all of them throw the same error. The package in question that it can't find I have verified is in the global package.json and it does show up in the global package-lock.json with that expected version.

Expected Behavior

The pruned lock file is created in the dist folder so its smaller than the global lock file.

GitHub Repo

No response

Steps to Reproduce

Slightly complicated, I initially thought it was due to having a dependency required in the specific app's package.json but I created a test repo with that and it worked the first time.

Nx Report

Node           : 18.19.0
OS             : darwin-arm64
Native Target  : aarch64-macos
npm            : 10.2.3

nx (global)        : 19.0.1
nx                 : 19.6.1
@nx/js             : 19.6.1
@nx/jest           : 19.6.1
@nx/linter         : 19.6.1
@nx/eslint         : 19.6.1
@nx/workspace      : 19.6.1
@nx/angular        : 19.6.1
@nx/devkit         : 19.6.1
@nx/esbuild        : 19.6.1
@nx/eslint-plugin  : 19.6.1
@nx/next           : 19.6.1
@nx/node           : 19.6.1
@nx/react          : 19.6.1
@nx/rollup         : 19.6.1
@nrwl/tao          : 19.6.1
@nx/vite           : 19.6.1
@nx/web            : 19.6.1
@nx/webpack        : 19.6.1
typescript         : 5.5.4
---------------------------------------
Community plugins:
@ionic/angular         : 6.7.5
@mands/nx-playwright   : 0.5.1
@ngrx/effects          : 18.0.2
@ngrx/operators        : 18.0.2
@ngrx/schematics       : 18.0.2
@ngrx/store            : 18.0.2
@ngrx/store-devtools   : 18.0.2
@simondotm/nx-firebase : 2.3.0
ng-mocks               : 14.13.0

Failure Logs

NX   An error occured while creating pruned lockfile

Please open an issue at `https://github.com/nrwl/nx/issues/new?template=1-bug.yml` and provide a reproduction.
To prevent the build from breaking we are returning the root lock file.
If you run `npm install --package-lock-only` in your output folder it will regenerate the correct pruned lockfile.

Original error: Pruned lock file creation failed. The following package was not found in the root lock file: firebase-admin@12.3.0


Error: Pruned lock file creation failed. The following package was not found in the root lock file: firebase-admin@12.3.0
    at /Users/robert.kirkpatrick/Code/layer/node_modules/nx/src/plugins/js/lock-file/project-graph-pruning.js:44:19
    at Array.forEach (<anonymous>)
    at normalizeDependencies (/Users/robert.kirkpatrick/Code/layer/node_modules/nx/src/plugins/js/lock-file/project-graph-pruning.js:30:42)
    at pruneProjectGraph (/Users/robert.kirkpatrick/Code/layer/node_modules/nx/src/plugins/js/lock-file/project-graph-pruning.js:13:34)
    at createLockFile (/Users/robert.kirkpatrick/Code/layer/node_modules/nx/src/plugins/js/lock-file/lock-file.js:171:79)
    at updatePackageJson (/Users/robert.kirkpatrick/Code/layer/node_modules/@nx/js/src/utils/package-json/update-package-json.js:62:61)
    at copyPackageJson (/Users/robert.kirkpatrick/Code/layer/node_modules/@nx/js/src/utils/package-json/index.js:26:53)
    at esbuildExecutor (/Users/robert.kirkpatrick/Code/layer/node_modules/@nx/esbuild/src/executors/esbuild/esbuild.impl.js:65:60)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async getLastValueFromAsyncIterableIterator (/Users/robert.kirkpatrick/Code/layer/node_modules/nx/src/utils/async-iterator.js:15:19)

Package Manager Version

npm 10.2.3

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions