generatePackageJson on nx 15 generates the the dependencies and versions differently than 14
See original GitHub issueCurrent Behavior
npm ci of a a copied apps dist directory breaks after update to nx 15 because the root package-lock.json dependency version does not match the generated package.json dependency version.
With nx 14 when using the "executor": "@nrwl/node:webpack", with "generatePackageJson": true the version of the dependency in the generated package.json matched the root package.json including the range.
With nx 15 and the same config the the generated package.json dependency appears to be the evaluated exact version without the range.
before nx 15
{
"scripts": {
"start": "node main.js",
"release": "semantic-release-plus"
},
"dependencies": {
"axios": "^0.26.0",
"dayjs": "^1.10.7",
"jsonc-parser": "^3.0.0",
"nodemailer": "^6.7.2",
"qs": "^6.10.3",
"tslib": "^2.0.0"
},
"main": "main.js"
}
after nx 15 update
{
"scripts": {
"start": "node main.js",
"release": "semantic-release-plus"
},
"dependencies": {
"axios": "0.26.1",
"call-bind": "1.0.2",
"dayjs": "1.11.5",
"follow-redirects": "1.15.2",
"function-bind": "1.1.1",
"get-intrinsic": "1.1.3",
"has": "1.0.3",
"has-symbols": "1.0.3",
"jsonc-parser": "3.2.0",
"nodemailer": "6.8.0",
"object-inspect": "1.12.2",
"qs": "6.11.0",
"side-channel": "1.0.4",
"tslib": "2.4.0"
},
"main": "main.js"
}
Expected Behavior
the versions in the generated package.json should be exactly the same including range of the root package.json
Steps to Reproduce
Working Branch using nx 14 - https://github.com/JoA-MoS/garage/
Bad branch PR using nx 15 - https://github.com/JoA-MoS/garage/pull/81
Run build on both and compare generated package.json
nx build campsite-watcher
nx docker-build campsite-watcher
Failure Logs
Environment
> NX Report complete - copy this into the issue template
Node : 16.18.0
OS : darwin x64
npm : 8.19.2
nx : 15.0.0
@nrwl/angular : 15.0.0
@nrwl/cypress : 15.0.0
@nrwl/detox : Not Found
@nrwl/devkit : 15.0.0
@nrwl/esbuild : Not Found
@nrwl/eslint-plugin-nx : 15.0.0
@nrwl/expo : Not Found
@nrwl/express : 15.0.0
@nrwl/jest : 15.0.0
@nrwl/js : 15.0.0
@nrwl/linter : 15.0.0
@nrwl/nest : 15.0.0
@nrwl/next : Not Found
@nrwl/node : 15.0.0
@nrwl/nx-cloud : 14.7.0
@nrwl/nx-plugin : Not Found
@nrwl/react : 15.0.0
@nrwl/react-native : Not Found
@nrwl/rollup : 15.0.0
@nrwl/schematics : Not Found
@nrwl/storybook : 15.0.0
@nrwl/web : 15.0.0
@nrwl/webpack : 15.0.0
@nrwl/workspace : 15.0.0
typescript : 4.8.4
---------------------------------------
Local workspace plugins:
---------------------------------------
Community plugins:
@semantic-release-plus/nx-tools: 1.0.0-alpha.6
@storybook/angular: 6.5.12
Issue Analytics
- State:
- Created a year ago
- Reactions:17
- Comments:70 (37 by maintainers)

Top Related StackOverflow Question
@FrozenPandaz @meeroslav is this something that is gonna be fixed/reverted to the 14.x behaviour or are you keeping it? I just think we all need some feedback because currently there is no valid solution to this. Thanks!
If I am looking at it correctly this change in behaviour was made in https://github.com/nrwl/nx/pull/12185
Any news on this?
After updating to nx 15 all my express apps using
generatePackageJson: truenow contain a whole bunch of dependencies which where not getting added when using v14When comparing the old output and the new, It looks like v15 is including all the peer dependencies as top level dependencies instead.
So I’m getting a lot of: