npm / npm/cli

[BUG] omit=peer causes bin creation to be skipped if matches name of a peer dep

Open
#8,373 1 comment 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

I have a case where https://github.com/CrowdStrike/commitlint/ has a bin of commitlint, but also has a dependency on commitlint-format-junit, which has a peerDependency on the npm package named commitlint. When adding @crowdstrike/commitlint to a repo like https://github.com/kellyselden/move-semver-tags-action, the peer dep wins over the conflicting bin name. That is fine, but when I add omit=peer https://github.com/kellyselden/move-semver-tags-action/pull/177, it also skips the bin name of commitlint from @crowdstrike/commitlint. I have to use the full path to commitlint to get it to work https://github.com/kellyselden/move-semver-tags-action/pull/180. The current state is this revert PR https://github.com/kellyselden/move-semver-tags-action/pull/181 that brings back a call to commitlint while having omit=peer will fail to find commitlint because of the naming conflict.

Expected Behavior

Adding omit=peer should ignore the peerDependency of commitlint, but preserve any commitlint bins from any other dependencies.

Steps To Reproduce

Check out https://github.com/kellyselden/move-semver-tags-action to see no commitlint bin in node_modules, even though it has a dependency on @crowdstrike/commitlint which exposes that bin. This is because it has omit=peer set, and there is a peerDependency with that same name in the graph.

Environment
  • npm: 11.4.2
  • Node.js: v22.16.0
  • OS Name: Win 10
  • System Model Name: PC
  • npm config:
engine-strict = true
include = []
omit = ["peer"]

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 issue in the linked move-semver-tags-action repository using npm 11.4.2 and omit=["peer"]. Compare the installed bins with and without omit=peer, focusing on the conflicting commitlint peer dependency and the @crowdstrike/commitlint bin. Done means the peer dependency is omitted while the commitlint bin from another dependency remains available.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.