Skip to content

npm install should install peerDependencies of a local module  #5108

Open
@KrisSodroski

Description

@KrisSodroski

Current Behavior

Given I have the following module:

{
  "name": "app",
  "version": "1.0.0",
  "dependencies": {
    "a": "^1.0.0",
    "b": "^1.0.0"
  }
}

{
  "name": "b",
  "version": "1.0.0",
  "peerDependencies": {
    "c": "^2.0.0"
  },
 "devDependencies": {
    "c": "^2.0.0"
  }
}

When installed through the registry, "app" correctly installed dependency c.

When installed through file path (localModule), dependency c is not installed.

{
  "name": "app",
  "version": "1.0.0",
  "dependencies": {
    "a": "^1.0.0",
    "b": "file:../some/path/b/dist/b"
  }
}

Expected Behavior

When developing modular systems, its imperative to be able to locally map modules for easy development.

To work around the above issue, application a must include all peerDependencies of b in its package.json file before application a will build correctly.

This is very cumbersome, and detracts from the advantages of transient peerDependencies in npm 7/8, and the work around lends itself to having applications like above continue to display pre-version 7 levels of package.json bloat simply due to carelessness or indifference.

I would expect that npm would install peerDependencies regardless of location of the package (registry/local/git).

Environment

npm: 8.3.1
Node.js: 14.16.0
OS Name: Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs Triageneeds review for next steps

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions