Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Invalid packages when scoped overrides are used butby a different package #7087

Open
2 tasks done
Tracked by #920
Anutrix opened this issue Dec 15, 2023 · 0 comments
Open
2 tasks done
Tracked by #920
Labels
Bug thing that needs fixing config:overrides Issues dealing with the overrides feature Priority 2 secondary priority issue

Comments

@Anutrix
Copy link

Anutrix commented Dec 15, 2023

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

npm install gives invalid package-lock.json when scoped overrides are used but project contains another dependency that uses it.
npm ls doesn't even show the culprit.

Expected Behavior

npm install should not give invalid packages when scoped overrides are used but project contains another dependency that uses it.
npm ls should be able to find and list the offending the package.

Steps To Reproduce

  1. In an empty folder, create a package.json with the contents:
{
  "name": "abc",
  "version": "1.2.3",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo 'Hi' && exit 1"
  },
  "author": "",
  "license": "MIT",
  "devDependencies": {
    "lerna": "4.0.0"
  },
  "dependencies": {
    "highcharts-export-server": "^2.1.0"
  },
  "overrides": {
    "highcharts-export-server": {
      "request": {
        "tough-cookie": "4.1.3"
      }
    }
  }
}
  1. npm install.
  2. Run npm ls tough-cookie:
❯ npm ls tough-cookie
npm ERR! code ELSPROBLEMS
npm ERR! invalid: tough-cookie@4.1.3 /Users/<username>/<path>/node_modules/tough-cookie
abc@1.2.3 /Users/<username>/<path>
└─┬ highcharts-export-server@2.1.0 overridden
  ├─┬ phantomjs-prebuilt@2.1.14
  │ └─┬ request@2.79.0 overridden
  │   └── tough-cookie@4.1.3 deduped invalid: "~2.5.0" from node_modules/request
  └─┬ request@2.88.2
    └── tough-cookie@4.1.3 invalid: "~2.5.0" from node_modules/request


npm ERR! A complete log of this run can be found in:

Notice the errors but there is no mention of lerna.
4. Remove lerna 4.0 or change it to lerna 5.0 which doesn't use request and repeat above steps. Notice there are no issues this time.

Environment

  • npm: 10.1.0
  • Node.js: 20.8.1
  • OS Name: Mac OS Sonoma 14.2
  • System Model Name: Macbook Pro - Intel i9
  • npm config:
; "user" config from /Users/<username>/.npmrc

registry = "https://registry.npmjs.org/"

; node bin location = /Users/<username>/n/bin/node
; node version = v20.8.1
; npm local prefix = /Users/<username>/<path>
; npm version = 10.1.0
; cwd = /Users/<username>/<path>
; HOME = /Users/<username>
; Run `npm config ls -l` to show all defaults.
@Anutrix Anutrix added Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x labels Dec 15, 2023
@lukekarrys lukekarrys added config:overrides Issues dealing with the overrides feature and removed Needs Triage needs review for next steps Release 10.x labels May 17, 2024
@kchindam-infy kchindam-infy added the Priority 2 secondary priority issue label Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing config:overrides Issues dealing with the overrides feature Priority 2 secondary priority issue
Projects
None yet
Development

No branches or pull requests

3 participants