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

Error: Build failed #1497

Closed
leog opened this issue Jun 8, 2024 · 9 comments
Closed

Error: Build failed #1497

leog opened this issue Jun 8, 2024 · 9 comments
Labels
Type: Bug Confirmed bug

Comments

@leog
Copy link

leog commented Jun 8, 2024

Describe the Bug

Getting errors when previewing out-of-the-box emails.

Error: Build failed with 3 errors: emails/notion-magic-link.tsx:11:7: ERROR: Could not resolve "@react-email/components" emails/notion-magic-link.tsx:26:4: ERROR: Could not resolve "react/jsx-runtime" emails/notion-magic-link.tsx:152:38: ERROR: [plugin: render-resolver] Failed trying to import `renderAsync` from either `@react-email/render` or `@react-email/components` to be able to render your email template. Maybe you don't have either of them installed?

Which package is affected (leave empty if unsure)

create-email

Link to the code that reproduces this issue

To Reproduce

Follow the instructions here https://react.email/docs/getting-started/automatic-setup

Expected Behavior

Have out-of-the-box emails preview successfully as shown in docs.

What's your node version? (if relevant)

v18.18.2

@leog leog added the Type: Bug Confirmed bug label Jun 8, 2024
@gabrielmfern
Copy link
Collaborator

Thinking this might be because by yarn modern's pnp. Here's an issue someone else also had #1422 (comment)

@iantanwx
Copy link

iantanwx commented Jun 10, 2024

@gabrielmfern getting the same issue, there are no pnp files in my project.

react-email@2.1.4
@react-email/component@0.0.19

@iantanwx
Copy link

iantanwx commented Jun 10, 2024

following up, I had to add react and react-dom as direct dependencies to my package. the project is a pnpm monorepo.

@leog
Copy link
Author

leog commented Jun 11, 2024

Not sure what's happening but I have this error in a personal project, works in one computer and not in another.

Also using pnpm workspaces, code in https://github.com/propsto/props.to/tree/auth-domain and by running in the root pnpm i and then pnpm dev:email you should be able to reproduce the issue... or not. Tried node v20 and v18.

Also tried including react and react-dom.

@gabrielmfern
Copy link
Collaborator

gabrielmfern commented Jun 11, 2024

@iantanwx From the comment I mentioned, the yarn files were not on their project but rather on their home:

That was it! I didn't use pnp (never actually have so I'm not sure where it came from), but I had .pnp.cjs .pnp.loader.mjs in my home directory.

From what you mention @leog,

works in one computer and not in another

I am pretty sure this is the same problem as said in the comment. Also, the repo you sent doesn't have the script nor does it have react-email installed 😅.

@leog
Copy link
Author

leog commented Jun 11, 2024

@gabrielmfern notice I shared a repo with a particular branch auth-domain, in it there is a package under packages folder called email

@gabrielmfern
Copy link
Collaborator

gabrielmfern commented Jun 11, 2024

I see it now, but no issues on my side:

image

Here's a separate comment on an issue talking about this evanw/esbuild#2647 (comment) (we use esbuild internally, that's precisely why this fails now). Thinking you have ran yarn on the home directory, or at some higher up directory, which causes esbuild to find these files all the way there and expect the modules' resolution to be done by it, not by pnpm.

@leog
Copy link
Author

leog commented Jun 11, 2024

Can't wait to go back to my other computer and find those bastard files braking my emal dev flow 😄
Thanks for the pointer @gabrielmfern, I'll let you know later today.

@leog
Copy link
Author

leog commented Jun 12, 2024

yeahp, found it at /Users/username//.pnp.cjs, fixed! thanks all!

@leog leog closed this as completed Jun 12, 2024
@gabrielmfern gabrielmfern closed this as not planned Won't fix, can't repro, duplicate, stale Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Confirmed bug
Projects
None yet
Development

No branches or pull requests

3 participants