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

Build error due to dependency installation #1432

Closed
junminahn opened this issue Apr 25, 2024 · 20 comments
Closed

Build error due to dependency installation #1432

junminahn opened this issue Apr 25, 2024 · 20 comments
Assignees
Labels
Package: react-email This is the CLI we generally use as just `email` on the temrinal. Type: Bug Confirmed bug

Comments

@junminahn
Copy link

Describe the Bug

When executing the command email build, I encountered the following error:

   ⠼ Installing dependencies on `.react-email`Error: Unable to install the dependencies and it exited with code: 1
    at /myproject/node_modules/react-email/cli/index.js:2083:36
    at /myproject/node_modules/shelljs/src/exec.js:145:9
    at ChildProcess.exithandler (node:child_process:430:5)
    at ChildProcess.emit (node:events:518:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)

Upon investigating further by running npm install in the .react-email directory, I found a more detailed error message:

/.react-email$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: react-email@2.1.1
npm ERR! Found: react@18.3.0
npm ERR! node_modules/react
npm ERR!   react@"^18.2.0" from the root project
npm ERR!   peer react@"^16.8 || ^17.0 || ^18.0" from @radix-ui/react-collapsible@1.0.3
npm ERR!   node_modules/@radix-ui/react-collapsible
npm ERR!     @radix-ui/react-collapsible@"1.0.3" from the root project
npm ERR!   5 more (react-dom, @radix-ui/react-popover, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! @react-email/components@"0.0.16" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: react@18.2.0
npm ERR! node_modules/react
npm ERR!   peer react@"18.2.0" from @react-email/components@0.0.16
npm ERR!   node_modules/@react-email/components
npm ERR!     @react-email/components@"0.0.16" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

This issue appears to stem from a conflict with the recently published version of react: https://www.npmjs.com/package/react

Which package is affected (leave empty if unsure)

react-email

Link to the code that reproduces this issue

https://www.npmjs.com/package/react

To Reproduce

  • run email build with the most recent version of react-email.

Expected Behavior

it builds the email templates without build errors.

What's your node version? (if relevant)

No response

@junminahn junminahn added the Type: Bug Confirmed bug label Apr 25, 2024
@gabrielmfern
Copy link
Collaborator

gabrielmfern commented Apr 25, 2024

It seems like we are having this same issue when building our demo application. Thank you for opening this issue!

@gabrielmfern gabrielmfern added the Package: react-email This is the CLI we generally use as just `email` on the temrinal. label Apr 25, 2024
@MatiasVerdier
Copy link

Same error with our project

@aaronmw
Copy link

aaronmw commented Apr 25, 2024

Same here. react@18.3.0 might fix? Can't build our app anymore either.

@thianphat
Copy link

likewise!

@mickasmt
Copy link

mickasmt commented Apr 26, 2024

Same for me.
This worked before react@18.3 was released. It seems react-email needs an update.
@aaronmw were you able to test?

@MatiasVerdier
Copy link

A temporary solution is patching the dependency to the exact react version (18.2.0). You can use pnpm patch or patch-package to accomplish this

@aaronmw
Copy link

aaronmw commented Apr 26, 2024

It's actually @react-email/components that won't install. I can install react-email with React 18.2.0 just fine, but the components package fails. I can't use patch-package on a package that won't even install, I don't think? @MatiasVerdier ?

@MatiasVerdier
Copy link

MatiasVerdier commented Apr 26, 2024

@aaronmw It worked for me, @react-email/components is already using the exact version 18.2.0 instead of ^18.2.0

https://github.com/resend/react-email/blob/main/packages/components/package.json#L66

The patch will allow you to install. I've used pnpm patch as you can see here
image

@aaronmw
Copy link

aaronmw commented Apr 26, 2024

Hmm. Maybe we have different issues. My project is using ^18.2.0 and I can install react-email just fine. In fact, it installs on ^18.3.0 as well. It's only @react-email/components that won't install on either version now. One conflicts with some group of packages, while another causes conflicts on another group of packages 🤦

@aaronmw
Copy link

aaronmw commented Apr 26, 2024

Oops, I see what you did. Patching react-email fixes @react-email/components — sorry, it's early 😆 Works now! 🎉 🙏

@MatiasVerdier
Copy link

MatiasVerdier commented Apr 26, 2024

@aaronmw but that's the issue, having ^18.2.0 means the project will install version 18.3.0 and that doesn't meet the criteria for @react-email/components and that's why it fails. once you change the dependency in react-email to be same it will work just fine

@gabrielmfern
Copy link
Collaborator

gabrielmfern commented Apr 26, 2024

We will be fixing this in a new version for @react-email/components today, and I will let you know once we do.

Update: we will try releasing on Monday

@aaronmw
Copy link

aaronmw commented Apr 26, 2024

@gabrielmfern Thank you 🙏 Seems my project doesn't build on 18.2.0 since some OTHER packages apparently insist on 18.3.0 already.

@mickasmt
Copy link

Currently, its works for me without pnpm patch.
Thanks all!!

@Meags27
Copy link

Meags27 commented Apr 26, 2024

Same issue here, a bunch of my vitest tests won't work because of this dependency issue with react and react-email

@praveentcom
Copy link

Looks like new version is not released yet. @gabrielmfern any ETA on this?

@gabrielmfern
Copy link
Collaborator

@praveentcom We weren't able to do it yesterday, will try Monday.

@anthonyhagi
Copy link

Any updates on when this will be released?

@gabrielmfern
Copy link
Collaborator

We just released a new version for all the packages that has a proper version for react as their peer dependencies. It is now ^18.2.0, so it should allow you to use either 18.2.0 or 18.3.0, and also with any patch version for them.

You should upgrade react-email and @react-email/components as well as any other individual components you have installed to the latest. If anyone experiences this issue or something like this, please let me know and I'll reopen the issue.

See https://github.com/resend/react-email/releases/tag/react-email%402.1.2

@praveentcom
Copy link

Thanks @gabrielmfern!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: react-email This is the CLI we generally use as just `email` on the temrinal. Type: Bug Confirmed bug
Projects
None yet
Development

No branches or pull requests

9 participants