npm install should install peerDependencies of a local module
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the package manifests and the local file dependency reproduction described in the issue, then compare it with the registry installation behavior. Done means peerDependencies are installed consistently when the package is resolved from the registry, a local file path, or git, without requiring the application to duplicate them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli, devtools, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100