Skip to content

Generated package-lock.json is invalid  #28051

@sjoholma

Description

@sjoholma

Current Behavior

After building an app which references an npm package juice the generated package-lock.json seems invalid.

Original package-lock.json contains the following reference:
"node_modules/web-resource-inliner/node_modules/dom-serializer/node_modules/domhandler"

But the generated package-lock.json drops this reference for some reason and thus the npm ci fails.

Expected Behavior

npm ci should succeed when run against the generated package.json

GitHub Repo

No response

Steps to Reproduce

  1. npx create-nx-workspace
  2. √ Where would you like to create your workspace? · org
  3. √ Which stack do you want to use? · node
  4. √ What framework should be used? · none
  5. √ Integrated monorepo, or standalone project? · standalone
  6. √ Would you like to generate a Dockerfile? [https://docs.docker.com/] · No
  7. √ Which CI provider would you like to use? · skip
  8. √ Would you like remote caching to make your build faster? · skip
  9. cd org
  10. npm i juice
  11. npm ci # This succeeds
  12. printf "import juice from \"juice\"; console.log(juice('foobar'));" >> src/main.ts
  13. npm run build
  14. cd dist/org
  15. npm ci # This fails

Nx Report

NX   Report complete - copy this into the issue template

Node           : 20.17.0
OS             : win32-x64
Native Target  : x86_64-windows
npm            : 10.8.2

nx                 : 19.8.0
@nx/js             : 19.8.0
@nx/jest           : 19.8.0
@nx/linter         : 19.8.0
@nx/eslint         : 19.8.0
@nx/workspace      : 19.8.0
@nx/devkit         : 19.8.0
@nx/esbuild        : 19.8.0
@nx/eslint-plugin  : 19.8.0
@nx/node           : 19.8.0
@nrwl/tao          : 19.8.0
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/jest/plugin

Failure Logs

npm error code EUSAGE
npm error
npm error `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
npm error
npm error Invalid: lock file's [email protected] does not satisfy [email protected]
npm error Invalid: lock file's [email protected] does not satisfy [email protected]
npm error
npm error Clean install a project
npm error
npm error Usage:
npm error npm ci
npm error
npm error Options:
npm error [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
npm error [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
npm error [--include <prod|dev|optional|peer> [--include <prod|dev|optional|peer> ...]]
npm error [--strict-peer-deps] [--foreground-scripts] [--ignore-scripts] [--no-audit]
npm error [--no-bin-links] [--no-fund] [--dry-run]
npm error [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
npm error [-ws|--workspaces] [--include-workspace-root] [--install-links]
npm error
npm error aliases: clean-install, ic, install-clean, isntall-clean
npm error
npm error Run "npm help ci" for more info

Package Manager Version

No response

Operating System

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

Additional Information

Workaround is to install the missing npm package after build e.g.

  1. cd dist/org
  2. npm ci # This fails
  3. npm i [email protected]
  4. npm ci # Now this succeeds

Metadata

Metadata

Assignees

Labels

priority: mediumMedium Priority (not high, not low priority)scope: nodeIssues related to Node, Express, NestJS support for Nxtype: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions