What versions are you using? (if relevant)
@react-email/components@x.y.z, react-email@x.y.z, etc.
Describe the Bug
Describe the bug
When deploying to Vercel using the official deployment guide, email build fails with:
✔ Successfully prepared `.react-email` for `next build`
sh: line 1: cross-env: command not found
Error: `npm run build` failed.
Note that .react-email is successfully prepared but then npm run build inside it fails because cross-env (and other packages) are not installed.
Root cause
In build.ts, installDependencies is called to install packages inside .react-email:
if (!isInReactEmailMonorepo) {
await installDependencies({ cwd: builtPreviewAppPath })
}
On Vercel isInReactEmailMonorepo = false so installDependencies should run — and based on logs it does start — but Vercel cancels or ignores the nested npm install inside .react-email subfolder. As a result .react-email/node_modules is never created and packages like cross-env, next, etc. are missing when npm run build runs.
Steps to reproduce
- Create a standard
react-email-starter project
- Follow the official Vercel deployment guide
- Set Framework Preset →
Next.js, Output Directory → .react-email/.next
- Push to Vercel — build fails
Environment
react-email: 5.2.9
@react-email/preview-server: 5.2.9
Node: 20.x (Vercel default)
Expected Behavior
When following the official Vercel deployment guide, running email build on Vercel
should automatically install all required dependencies inside .react-email and
successfully complete next build without any manual workarounds.
What versions are you using? (if relevant)
@react-email/components@x.y.z, react-email@x.y.z, etc.
Describe the Bug
Describe the bug
When deploying to Vercel using the official deployment guide, email build fails with:
Note that .react-email is successfully prepared but then npm run build inside it fails because cross-env (and other packages) are not installed.
Root cause
In build.ts, installDependencies is called to install packages inside .react-email:
On Vercel
isInReactEmailMonorepo = falsesoinstallDependenciesshould run — and based on logs it does start — but Vercel cancels or ignores the nestednpm installinside.react-emailsubfolder. As a result.react-email/node_modulesis never created and packages likecross-env,next, etc. are missing whennpm run buildruns.Steps to reproduce
react-email-starterprojectNext.js, Output Directory →.react-email/.nextEnvironment
react-email: 5.2.9
@react-email/preview-server: 5.2.9
Node: 20.x (Vercel default)
Expected Behavior
When following the official Vercel deployment guide, running
email buildon Vercelshould automatically install all required dependencies inside
.react-emailandsuccessfully complete
next buildwithout any manual workarounds.