react-email
react-email copied to clipboard
Build error due to dependency installation
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: [email protected]
npm ERR! Found: [email protected]
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/[email protected]
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: [email protected]
npm ERR! node_modules/react
npm ERR! peer react@"18.2.0" from @react-email/[email protected]
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 buildwith the most recent version ofreact-email.
Expected Behavior
it builds the email templates without build errors.
What's your node version? (if relevant)
No response
It seems like we are having this same issue when building our demo application. Thank you for opening this issue!
Same error with our project
Same here. [email protected] might fix? Can't build our app anymore either.
likewise!
Same for me. This worked before [email protected] was released. It seems react-email needs an update. @aaronmw were you able to test?
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
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 ?
@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
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 π€¦
Oops, I see what you did. Patching react-email fixes @react-email/components βΒ sorry, it's early π Works now! π π
@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
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
@gabrielmfern Thank you π Seems my project doesn't build on 18.2.0 since some OTHER packages apparently insist on 18.3.0 already.
Currently, its works for me without pnpm patch. Thanks all!!
Same issue here, a bunch of my vitest tests won't work because of this dependency issue with react and react-email
Looks like new version is not released yet. @gabrielmfern any ETA on this?
@praveentcom We weren't able to do it yesterday, will try Monday.
Any updates on when this will be released?
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
Thanks @gabrielmfern!