Skip to content

[BUG] npm install infinite loop with bundledDependency and overrides #9227

@everett1992

Description

@everett1992

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

Create a package that depends on chevrotain ^11 (not the latest v12), bundles dependencies, and overrrides lodash-es.

{
  "name": "test",
  "dependencies": {
    "chevrotain": "^11.2.0"
  },
  "bundledDependencies": true,
  "overrides": {
    "lodash-es": "^4.18"
  }
}

npm install runs indefinitely, printing the same log lines repeatedly.:

$ npm install --loglevel silly
npm silly placeDep ROOT lodash-es@4.18.1 REPLACE for: @chevrotain/cst-dts-gen@11.2.0 want: 4.18
npm silly placeDep ROOT lodash-es@4.18.1 REPLACE for: @chevrotain/gast@11.2.0 want: 4.18
npm silly placeDep ROOT lodash-es@4.18.1 REPLACE for: @chevrotain/cst-dts-gen@11.2.0 want: 4.18
npm silly placeDep ROOT lodash-es@4.18.1 REPLACE for: @chevrotain/gast@11.2.0 want: 4.18
npm silly placeDep ROOT lodash-es@4.18.1 REPLACE for: @chevrotain/cst-dts-gen@11.2.0 want: 4.18

Expected Behavior

I expect npm to override chevrotain's lodash-es depednency, and produce a tarball that bundles the overridden version. The bundled version should satisfy dependency when installed, or this should create an explicit error if overriding bundled dependencies are not allowed (I know that overrides are normally not applied when the package is installed as a dependency, so it seems reasonable that you cannot override bundled dependencies)

Steps To Reproduce

  1. npm 11.12.1, node 24.14.1, Ubuntu
  2. package.json depending on chevrotain, bundledDependencies, and an lodash-es override.
  3. Run 'npm install`
  4. See infinte loop

Environment

  • npm: 11.12.1
  • Node.js: 24.14.1
  • OS Name: Ubuntu
  • System Model Name: Lenovo
  • npm config:
; node bin location = ~/.local/share/mise/installs/node/24.14.1/bin/node
; node version = v24.14.1
; npm local prefix =~/github/test
; npm version = 11.12.1
; cwd = ~/github/test
; HOME = ~
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next steps

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions