Next.js Discord

Discord Forum

Failed to load external module prettier-3c69a91af3bc4731/plugins/html: Error [ERR_MODULE_NOT_FOUND]:

Unanswered
Japanese cockle posted this in #help-forum
Open in Discord
Japanese cockleOP
Upgraded from canary.32 to canary.60 now I got this runtime error rendering email with react-email:

Error: Failed to load external module prettier-3c69a91af3bc4731/plugins/html: Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'prettier-3c69a91af3bc4731' imported from /var/task/apps/nextjs/.next/server/chunks/ssr/[turbopack]_runtime.js
    at Context.externalImport [as y] (.next/server/chunks/ssr/[turbopack]_runtime.js:616:15)
    at async (.next/server/chunks/ssr/[root-of-the-server]__0u01jw5._.js:1838:187) {
  digest: '4056083357'
}


Prettier is subdependency of react-email
This error occurs using render() function of react-email

13 Replies

@Japanese cockle shot in the dark try deleting you .next dir
@Patrick MacDonald <@1095776817601859604> shot in the dark try deleting you .next dir
Japanese cockleOP
The thing is, this works in dev server, the problem only happens when deployed to vercel
I get that in the logs
It was working good in canary.32, but now it errors in vercel
Clear the vercel build cache? Sorry I'm not really sure I was gust guessing
@Patrick MacDonald Clear the vercel build cache? Sorry I'm not really sure I was gust guessing
Japanese cockleOP
Redeployed and still errors
Japanese cockleOP
I realized it's not a problem with react-email render() function, I just change all that with this action.ts

"use server";

export async function removeMember(props: { userId: number }) {
  console.log("AAAA", props);
  return "ok";
};


and client.tsx

"use client";

import { Button } from "@/components/ui/button";
import { removeMember } from "./action";
import { XIcon } from "lucide-react";

export default function Org() {
  return (
    <Button
      variant="secondary"
      size="icon"
      onClick={async () => {
        await removeMember({
          userId: 1,
        });
      }}
    >
      <XIcon />
    </Button>
  );
}


I still get the same error
Japanese cockleOP
I made a new project from scratch and tried to run that code, it works no issue, even with react-email
It is more likely a turbopack issue
Japanese cockleOP
@Patrick MacDonald I built it and run it locally, it works fine locally with turbopack, the problem is vercel + turbopack

Then I experimented with --webpack in vercel, it works.

So, I feel there's something wrong with vercel + turbopack
I will be using --webpack for now
I wish I could be of more help. I'm not exactly sure, when you install. Are you using legacy peers? If so, you have to update the install script in Vercel
Because I know sometimes packages don't play nice with Canary and if you originally install them and then update Canary later, you might not get the message that it requires legacy peers