npm / npm/cli

[BUG] npm possibly installs wrong dependencies

Open
#7,300 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Needs Triage
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

Based on the discussion with the maintainer of the typescript-eslint project in the SR https://github.com/typescript-eslint/typescript-eslint/issues/8732, npm 10.5.0 wrongly resolves a dependency.

If you check the version listed in ./node_modules/@typescript-eslint/utils/package.json it should be v7
If it's v5 then double check ./node_modules/typescript-eslint - it should contain its own ./node_modules/@typescript-eslint/utils which is v7.
If you don't have a v7 version of the utils package - then that's the cause - npm is doing the wrong thing.

Expected Behavior

No response

Steps To Reproduce

Install:

{
	"name": "test",
	"type": "commonjs",
	"devDependencies": {
		"@eslint/js": "8.57.0",
		"cross-env": "7.0.3",
		"eslint": "8.57.0",
		"eslint-plugin-jest": "27.9.0",
		"typescript": "5.4.2",
		"typescript-eslint": "7.3.1"
	}
}
Environment
  • npm: 10.5.0
  • Node.js: 20.11.0
  • OS Name: macOS
  • System Model Name: Macbook Pro
  • npm config:
//registry.npmjs.org/:_authToken = (protected)
audit = false
fund = false

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

Reproduce the installation using the supplied package.json with npm 10.5.0, Node.js 20.11.0, and the listed dependencies. Inspect node_modules/@typescript-eslint/utils/package.json and node_modules/typescript-eslint/node_modules/@typescript-eslint/utils to verify whether version 7 is resolved and nested as described; done means npm consistently installs the expected versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
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.