[BUG] Install issues for package both in devDependencies and peerDependencies
Nobody has claimed this yet.
- 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
Current Behavior
When both devDependencies and peerDependencies are specified for a package:
- Installing a local .tgz fails with "Invalid comparator" error.
- Installing a version that mismatches with peerDependencies version fails to either warn about a mismatch OR update the peerDependencies version
With just peerDependencies specified, both of the above completely replace the peerDependencies version
Scenario: Developers of a particular repository are using npm@7 (with package-lock.json committed), but CI builds (on server supporting multiple repositories) are using npm@6 with npm ci. With npm@7, peerDependencies is enough to install the package in CI environment, but with npm@6, we need devDependencies to install on CI environment.
"devDependencies": {
"some-package": "^1.1.0"
},
"peerDependencies": {
"some-package": ">= 1.1.0"
},
Expected Behavior
With
"devDependencies": {
"some-package": "^1.1.0"
},
"peerDependencies": {
"some-package": ">= 1.1.0"
},
- `npm install some-package-1.2.0.tgz" succeeds and updates only devDependencies version OR succeeds and updates both devDependencies and peerDependencies versions
- `npm install some-package@1.0.0" either fails due to peerDependencies mismatch OR succeeds and updates both devDependencies and peerDependencies versions
- `npm install some-package-1.0.0.tgz" either fails due to peerDependencies mismatch OR succeeds and updates both devDependencies and peerDependencies versions
Steps To Reproduce
- Use create-react-app to create "some-package".
- Set version to 1.1.0
npm packto create some-package-1.1.0.tgz- Use create-react-app to create a "downstream" package.
- Set devDependencies and peerDependencies as shown in current behavior.
npm install some-package-1.1.0.tgz. "Invalid comparator" error seen- Pick some published npm package with multiple versions.
- Set devDependencies and peerDependencies with conflicting versions for that package.
npm installNo warning seen.
Environment
- OS: Windows 10
- Node: 16
- npm: 7.12.1
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
Reproduce the issue with the create-react-app packages and the shown devDependencies and peerDependencies using npm 7.12.1, then compare local tarball installs with published-package installs. Investigate the Invalid comparator failure and the missing peer-dependency mismatch warning or update. Done means the three expected install scenarios either fail clearly on mismatch or update the relevant dependency versions consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli, developer-experience
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100