Closed ThisIsMissEm closed 2 years ago
This occurs because npm by default (as of v7) automatically install peer dependencies for packages. This then butts up against npm's desire to install one version of a package if it's specified as a peer dependency.
Put another way, if you do:
npm i @typescript-eslint/eslint-plugin@canary
That's the same as doing this:
npm i @typescript-eslint/eslint-plugin@canary @typescript-eslint/parser@^5.0.0
Which then follows that the command you mentioned in your post is actually:
npm i @typescript-eslint/eslint-plugin@canary @typescript-eslint/parser@canary @typescript-eslint/parser@^5.0.0
Which explains why npm is erroring here - it thinks you're asking it to install both @canary
(@5.30.8-alpha.2
) AND @^5.0.0
- which means you're asking for two incompatible versions to be installed in the root!
Why is the canary
version incompatible? Because by definition npm's semver handling excludes pre-release tags from semver ranges, unless the range specifies a prerelease tag!
I.e. ^5.0.0
does not match 5.30.8-alpha.2
.
As far as I can tell from the docs - there's literally no semver that can be used to match "every v5.x.x pre-release AND every v5.x.x full-release".
Which means we're sadly stuck here with no possible resolution, I believe.
However, you can work around this locally by using the --legacy-peer-deps
flag, which will opt-out of the auto-install behaviour.
@bradzacher hm, okay; would you be able to do a 5.30.8
release soon? The issue we're having is that npm audit
is failing on the latest package (frustratingly, because of eslint-plugin-jest
that's depended on by something in the @typescript-eslint
package graph).
https://github.com/typescript-eslint/typescript-eslint#versioning
Next release is Monday. There have been no user-facing commits to main since the last release (which was yesterday) so a release now wouldn't do anything anyways.
If it's the audit I think you're talking about - it won't be resolved because we can't resolve it. https://github.com/typescript-eslint/typescript-eslint/issues/5353
Suggestion
This might be because of my setup, I'm not sure, but when trying to install the canary in our shared linting repo, we receive:
The report is:
I've tried rerunning with
--force
and even using theoverrides
functionality in npm, but I'm thinking maybe something has gone wrong with the latest canary publish?