You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have npm package (with some sub-dependencies), which I'm using in nestjs app.
During build of app creation of lock file fails.
After removal of this package usage, problem is not happening.
Expected Behavior
I should be able to use npm package and lock file should be created successfully.
nx run example-api:build [existing outputs match the cache, left as is]
webpack-cli build --node-env=production
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: Following packages could not be mapped to the NPM lockfile:
npm:@aws-sdk/[email protected]
at nestMappedPackages (/Users/dominik/code/nx-npm-workspace/node_modules/nx/src/plugins/js/lock-file/npm-parser.js:367:15)
at nestMappedPackages (/Users/dominik/code/nx-npm-workspace/node_modules/nx/src/plugins/js/lock-file/npm-parser.js:373:9)
at nestMappedPackages (/Users/dominik/code/nx-npm-workspace/node_modules/nx/src/plugins/js/lock-file/npm-parser.js:373:9)
at mapSnapshots (/Users/dominik/code/nx-npm-workspace/node_modules/nx/src/plugins/js/lock-file/npm-parser.js:309:9)
at stringifyNpmLockfile (/Users/dominik/code/nx-npm-workspace/node_modules/nx/src/plugins/js/lock-file/npm-parser.js:239:28)
at createLockFile (/Users/dominik/code/nx-npm-workspace/node_modules/nx/src/plugins/js/lock-file/lock-file.js:172:58)
at /Users/dominik/code/nx-npm-workspace/node_modules/@nx/webpack/src/plugins/generate-package-json-plugin.js:40:138
at fn (/Users/dominik/code/nx-npm-workspace/node_modules/webpack/lib/Compilation.js:497:10)
at _next0 (eval at create (/Users/dominik/code/nx-npm-workspace/node_modules/tapable/lib/HookCodeFactory.js:33:10), :11:1)
at eval (eval at create (/Users/dominik/code/nx-npm-workspace/node_modules/tapable/lib/HookCodeFactory.js:33:10), :24:1)
Current Behavior
I have npm package (with some sub-dependencies), which I'm using in nestjs app.
During build of app creation of lock file fails.
After removal of this package usage, problem is not happening.
Expected Behavior
I should be able to use npm package and lock file should be created successfully.
GitHub Repo
https://github.com/dpotera/nx-npm-example
Steps to Reproduce
npm install
npx nx build example-api
- prints errorNx Report
NX Report complete - copy this into the issue template
Node : 22.0.0
OS : darwin-arm64
Native Target : aarch64-macos
npm : 10.5.1
nx (global) : 20.0.0
nx : 20.0.10
@nx/js : 20.0.10
@nx/jest : 20.0.10
@nx/eslint : 20.0.10
@nx/workspace : 20.0.10
@nx/devkit : 20.0.10
@nx/eslint-plugin : 20.0.10
@nx/nest : 20.0.10
@nx/node : 20.0.10
@nx/web : 20.0.10
@nx/webpack : 20.0.10
typescript : 5.5.4
Registered Plugins:
@nx/webpack/plugin
@nx/eslint/plugin
@nx/jest/plugin
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: Following packages could not be mapped to the NPM lockfile:
Error: Following packages could not be mapped to the NPM lockfile:
at nestMappedPackages (/Users/dominik/code/nx-npm-workspace/node_modules/nx/src/plugins/js/lock-file/npm-parser.js:367:15)
at nestMappedPackages (/Users/dominik/code/nx-npm-workspace/node_modules/nx/src/plugins/js/lock-file/npm-parser.js:373:9)
at nestMappedPackages (/Users/dominik/code/nx-npm-workspace/node_modules/nx/src/plugins/js/lock-file/npm-parser.js:373:9)
at mapSnapshots (/Users/dominik/code/nx-npm-workspace/node_modules/nx/src/plugins/js/lock-file/npm-parser.js:309:9)
at stringifyNpmLockfile (/Users/dominik/code/nx-npm-workspace/node_modules/nx/src/plugins/js/lock-file/npm-parser.js:239:28)
at createLockFile (/Users/dominik/code/nx-npm-workspace/node_modules/nx/src/plugins/js/lock-file/lock-file.js:172:58)
at /Users/dominik/code/nx-npm-workspace/node_modules/@nx/webpack/src/plugins/generate-package-json-plugin.js:40:138
at fn (/Users/dominik/code/nx-npm-workspace/node_modules/webpack/lib/Compilation.js:497:10)
at _next0 (eval at create (/Users/dominik/code/nx-npm-workspace/node_modules/tapable/lib/HookCodeFactory.js:33:10), :11:1)
at eval (eval at create (/Users/dominik/code/nx-npm-workspace/node_modules/tapable/lib/HookCodeFactory.js:33:10), :24:1)
chunk (runtime: main) main.js (main) 2.84 KiB [entry] [rendered]
webpack compiled successfully (40f57bfe94298383)
Package Manager Version
npm version 10.5.1
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: