withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
47k stars 2.5k forks source link

`@astrojs/react` is broken on `npm install` command #10984

Closed mika-f closed 6 months ago

mika-f commented 6 months ago

Astro Info

Astro                    v4.8.0
Node                     v18.19.0
System                   Windows (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Failed to install @astrojs/react of latest release.

npm run astro add react

> green-galaxy@0.0.1 astro
> astro add react

✔ Resolving packages...

  Astro will run the following command:
  If you skip this step, you can always run it yourself later

 ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
 │ npm install @astrojs/react@^3.3.3 @types/react@^null @types/react-dom@^null react@^18.3.1 react-dom@^18.3.1  │
 ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

√ Continue? ... yes
✖ Installing dependencies...

 Command failed with exit code 1: npm install @astrojs/react@^3.3.3 @types/react@^null @types/react-dom@^null react@^18.3.1 react-dom@^18.3.1
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "^null" of package "@types/react@^null": Tags may not have any characters that encodeURIComponent encodes.

npm ERR! A complete log of this run can be found in: C:\Users\REDACTED\AppData\Local\npm-cache\_logs\2024-05-09T11_58_24_625Z-debug-0.log

Astro could not update your astro.config.js file safely.
Reason: Unable to install dependencies

You will need to add these integration(s) manually.
Documentation: https://docs.astro.build/en/guides/integrations-guide/
  Stack trace:
    at add (file:///C:/a/green-galaxy/node_modules/astro/dist/cli/add/index.js:218:31)
    at async runCommand (file:///C:/a/green-galaxy/node_modules/astro/dist/cli/index.js:117:7)

What's the expected result?

Successfully install it without any errors.

Link to Minimal Reproducible Example

https://github.com/mika-sandbox/astro-add-react-broken

Participation

bluwy commented 6 months ago

Likely due to https://github.com/withastro/astro/blob/770b9f06c3d67f89de527d8b3a842555e596c01f/packages/integrations/react/package.json#L62-L64

Reikon95 commented 6 months ago

Also just started getting this error whenever adding react.

emish89 commented 6 months ago

Likely due to

https://github.com/withastro/astro/blob/770b9f06c3d67f89de527d8b3a842555e596c01f/packages/integrations/react/package.json#L62-L64

Yeah, I confirm that removing these 2 npm:types- everything works again.

emish89 commented 6 months ago

I created this https://github.com/withastro/astro/pull/10986/files

Reikon95 commented 6 months ago
Screenshot 2024-05-09 at 15 36 10

This seems to have merged but I'm still getting this, even after updating astro

mika-f commented 6 months ago

I confirmed that this problem has been resolved. Thank you for your quick response & release!