npm / npm/cli

[BUG] legacy-bundling=true breaks transitive dependencies

Open
#4,058 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Priority 2 Release 8.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

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

.npmrc:

package-lock=false
legacy-bundling=true

package.json:

{
  "dependencies": {
    "tap": "^15.1.1"
  }
}
❯ npm ls fs.realpath
npm-bundling-test@ /private/tmp/18/npm-bundling-test
└─┬ tap@15.1.1
  ├── fs.realpath@1.0.0 extraneous
  └─┬ glob@7.2.0
    └── fs.realpath@ invalid: "^1.0.0" from node_modules/tap/node_modules/glob

npm ERR! code ELSPROBLEMS
npm ERR! extraneous: fs.realpath@1.0.0 /private/tmp/18/npm-bundling-test/node_modules/tap/node_modules/fs.realpath
npm ERR! invalid: fs.realpath@ /private/tmp/18/npm-bundling-test/node_modules/tap/node_modules/glob/node_modules/fs.realpath

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jsumners/.npm/_logs/2021-11-18T15_26_46_008Z-debug.log
Expected Behavior

When installing packages with legacy-bundling=true, transitive dependencies should not result in the npm error code ELSPROBLEMS.

Steps To Reproduce
  1. Node LTS v16.13.0
  2. See "Current Behavior" above
  3. npm install && npm ls fs.realpath
  4. See error...
Environment
  • npm: 8.1.0
  • Node: 16.13.0
  • OS: 12.0.1
  • platform: macOS
  • npm config:
; "project" config from /private/tmp/18/npm-bundling-test/.npmrc

legacy-bundling = true 
package-lock = false 

; node bin location = /Users/jsumners/n/bin/node
; cwd = /private/tmp/18/npm-bundling-test
; HOME = /Users/jsumners
; Run `npm config ls -l` to show all defaults.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the report with the shown .npmrc and package.json, then run npm install && npm ls fs.realpath using the listed Node and npm versions. Trace the legacy-bundling installation and dependency-tree handling until the transitive fs.realpath entries are processed. Done means the reproduction no longer reports ELSPROBLEMS.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.