Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix astro add react #10988

Closed
wants to merge 1 commit into from
Closed

Fix astro add react #10988

wants to merge 1 commit into from

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented May 9, 2024

Changes

Fix #10984

Alternative to #10986 to not remove the npm: peer deps, if it works.

Testing

Ran astro add react manually.

Docs

n/a.

Copy link

changeset-bot bot commented May 9, 2024

🦋 Changeset detected

Latest commit: e763d2d

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label May 9, 2024
@@ -693,7 +693,16 @@ async function resolveRangeToInstallSpecifier(name: string, range: string): Prom
if (versions instanceof Error) return name;
// Filter out any prerelease versions
const stableVersions = versions.filter((v) => !v.includes('-'));
// Peer dependencies may sometimes use the `npm:` specifier, but `semver` package panics with it.
// Filter it out if so.
if (range.includes('npm:')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: startsWith

@bluwy
Copy link
Member Author

bluwy commented May 9, 2024

Closing as npm: specifiers don't work in peer deps.

@bluwy bluwy closed this May 9, 2024
@bluwy bluwy deleted the fix-add-react branch May 9, 2024 13:28
@CGQAQ
Copy link
Contributor

CGQAQ commented May 10, 2024

It is not that npm: don't work in peer deps, it's because that you can not mix alias with other specifiers,
for example, npm tries to treat the whole part after npm: (which is types-react-dom@beta || npm:types-react-dom@beta) as the package was aliased to.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@astrojs/react is broken on npm install command
3 participants