react-email: 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: 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 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
About this issue
- Original URL
- State: closed
- Created 2 months ago
- Reactions: 9
- Comments: 20
@praveentcom We weren’t able to do it yesterday, will try Monday.
We just released a new version for all the packages that has a proper version for
reactas their peer dependencies. It is now^18.2.0, so it should allow you to use either18.2.0or18.3.0, and also with any patch version for them.You should upgrade
react-emailand@react-email/componentsas 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
Oops, I see what you did. Patching
react-emailfixes@react-email/components— sorry, it’s early 😆 Works now! 🎉 🙏@aaronmw It worked for me,
@react-email/componentsis already using the exact version18.2.0instead of^18.2.0https://github.com/resend/react-email/blob/main/packages/components/package.json#L66
The patch will allow you to install. I’ve used
pnpm patchas you can see hereIt seems like we are having this same issue when building our demo application. Thank you for opening this issue!
@gabrielmfern Thank you 🙏 Seems my project doesn’t build on
18.2.0since some OTHER packages apparently insist on 18.3.0 already.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