Skip to content

Email app build fails - missing --dir flag in build/export scripts #619

@jonathanagustin

Description

@jonathanagustin

Describe the bug
The email app build command fails when run from apps/email because it cannot find a ./emails folder within that directory. The react-email CLI defaults to looking for templates in a ./emails directory relative to where the command is run, but no such directory exists in apps/email. The project's email templates are actually located in packages/email/templates.

next-forge version
I am using version latest (main branch)

To Reproduce
Steps to reproduce the behavior:

  1. Navigate to the project root directory
  2. Run turbo build --filter=email
  3. See the build fail with error message

Error output:

> [email protected] build /home/user/studyberserk/apps/email
> email build

   ✖ Checking if ./emails folder exists
 ELIFECYCLE  Command failed with exit code 1.

Expected behavior
The email app should build successfully, creating the preview app in .react-email directory and completing the turbo build process without errors.

Root Cause & Fix
The build and export scripts in apps/email/package.json were missing the --dir flag to specify the correct templates directory, while the dev script correctly included it.

Fix: Update the scripts to include the --dir flag:

{
  "scripts": {
    "build": "email build --dir ../../packages/email/templates",
    "export": "email export --dir ../../packages/email/templates"
  }
}

Desktop:

  • OS: Linux (RHEL 9.6)
  • Node.js: v22.18.0
  • Package Manager: pnpm
  • Turbo: 2.5.3
  • react-email: 4.0.15

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions