Can’t build/deploy to github pages my NextJS app after implementing next-intl

  Kiến thức lập trình

So i’ve added the generateStaticParams to my app/[locale]/layout.tsx file and unstable_setRequestLocale to all the layout and page files refering to the next-intl docs

and i get the following error while github tries to build it.

Injecting property=output and value=export in:
import createNextIntlPlugin from 'next-intl/plugin';
const withNextIntl = createNextIntlPlugin();
/** @type {import('next').NextConfig} */
const nextConfig = {};
export default withNextIntl(nextConfig);
Error: TypeError: error must be an instance of Error

my app/[locale]/layout.tsx looks like this:

import { Inter } from "next/font/google";
import "./globals.css";
import {NextIntlClientProvider} from 'next-intl';
import {getMessages} from 'next-intl/server';
import {unstable_setRequestLocale} from 'next-intl/server';

const locales = ['en', 'pt'];

export function generateStaticParams() {
  return => ({locale}));

const inter = Inter({ subsets: ["latin"] });

export default async function RootLayout({
  params: {locale},
}: Readonly<{
  children: React.ReactNode;
    locale: string;



  const messages = await getMessages();

  return (
    <html lang={locale}>
      <body className={inter.className}>
        <NextIntlClientProvider locale={locale} messages={messages}>

it says i need to call this function in every layout and page files, but in my main (/app/[locale]/page.tsx) file, i can’t call it since i’m using “use client”.

so in dev build it works fine, but once i try to push it to github it throws me that error.

i’m sorry if this is not enough information, i’m new to nextjs.

New contributor

Vitor Hugo Cunha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.