npm / npm/cli

[install] npm7 and above installation project dependencies on error warning to use the legacy-peer-deps parameter

Open
#5,925 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting Information Bug Needs Triage Release 9.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

Run the npm install command directly to install the dependencies, and the error "could not resolve" is reported to terminate the dependencies installation.

Compared with using yarn install command to install the dependencies, the project dependencies can be installed normally, and there is no situation that the dependencies installation cannot be installed.

Moreover, because the preinstall hook does not work properly (preinstall not works), it is impossible to set the command to configure the legacy-peer-deps parameter in preinstall hook.

Expected Behavior

Is there any way that npm install command can install dependencies normally?

Steps To Reproduce
  1. In this environment...
  2. With this config...
  3. Run '...'
  4. See error...
Environment
  • npm: 9.1.3
  • Node.js: v18.12.1
  • OS Name: Ubuntu 20.04.4 LTS
  • System Model Name: Linux version 5.4.0
  • npm config:
; "user" config from /home/yfw/.npmrc

registry = "https://repo.huaweicloud.com/repository/npm/"
strict-ssl = false

; "cli" config from command line options

location = "project"

; node bin location = /home/yfw/bin/node-v18.12.1-linux-x64/bin/node
; node version = v18.12.1
; npm local prefix = /home/yfw/code/compiler
; npm version = 9.1.3
; cwd = /home/yfw/code/compiler
; HOME = /home/yfw
; 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

The report concerns npm install with npm 9.1.3 and Node.js v18.12.1, using the shown npm configuration; start by reproducing the dependency-resolution error on Ubuntu 20.04.4. Compare npm install with yarn install and investigate the referenced preinstall-hook limitation and legacy-peer-deps behavior. The incomplete reproduction steps and missing dependency files make the expected fix unclear.

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
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.