creativetimofficial / material-tailwind

@material-tailwind is an easy-to-use components library for Tailwind CSS and Material Design.
https://material-tailwind.com/
MIT License
3.72k stars 316 forks source link

Error while Generating static pages in Next JS 13.4 #468

Open FilipJurkovic opened 11 months ago

FilipJurkovic commented 11 months ago

Hi all, I am using Material Tailwind components with Next JS 13.4 with App router and server components as per instructions in the Material Tailwind docs. Everything is running well locally but when trying to build the app and send it to vercel I encountered a strange error and have been stuck for 3 days, I will copy the terminal logs here:

 ✓ Creating an optimized production build
 ✓ Compiled successfully
 ✓ Linting and checking validity of types
 ✓ Collecting page data
   Generating static pages (1/7)  [=   ]
RangeError: Maximum call stack size exceeded
    at P (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:100780)
    at l (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:95971)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97172
    at Array.forEach (<anonymous>)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97145
    at Array.forEach (<anonymous>)
    at a (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:96965)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97229
    at Array.forEach (<anonymous>)
    at l (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:96922)

Error occurred prerendering page "/_not-found". Read more: https://nextjs.org/docs/messages/prerender-error
RangeError: Maximum call stack size exceeded
    at P (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:100780)
    at l (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:95971)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97172
    at Array.forEach (<anonymous>)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97145
    at Array.forEach (<anonymous>)
    at a (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:96965)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97229
    at Array.forEach (<anonymous>)
    at l (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:96922)
RangeError: Maximum call stack size exceeded
    at P (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:100780)
    at l (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:95971)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97172
    at Array.forEach (<anonymous>)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97145
    at Array.forEach (<anonymous>)
    at a (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:96965)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97229
    at Array.forEach (<anonymous>)
    at l (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:96922)

Error occurred prerendering page "/companies". Read more: https://nextjs.org/docs/messages/prerender-error
RangeError: Maximum call stack size exceeded
    at P (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:100780)
    at l (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:95971)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97172
    at Array.forEach (<anonymous>)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97145
    at Array.forEach (<anonymous>)
    at a (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:96965)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97229
    at Array.forEach (<anonymous>)
    at l (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:96922)
RangeError: Maximum call stack size exceeded
    at P (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:100780)
    at l (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:95971)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97172
    at Array.forEach (<anonymous>)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97145
    at Array.forEach (<anonymous>)
    at a (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:96965)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97229
    at Array.forEach (<anonymous>)
    at l (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:96922)

Error occurred prerendering page "/tenants". Read more: https://nextjs.org/docs/messages/prerender-error
RangeError: Maximum call stack size exceeded
    at P (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:100780)
    at l (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:95971)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97172
    at Array.forEach (<anonymous>)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97145
    at Array.forEach (<anonymous>)
    at a (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:96965)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97229
    at Array.forEach (<anonymous>)
    at l (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:96922)
RangeError: Maximum call stack size exceeded
    at P (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:100780)
    at l (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:95971)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97172
    at Array.forEach (<anonymous>)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97145
    at Array.forEach (<anonymous>)
    at a (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:96965)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97229
    at Array.forEach (<anonymous>)
    at l (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:96922)

Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
RangeError: Maximum call stack size exceeded
    at P (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:100780)
    at l (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:95971)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97172
    at Array.forEach (<anonymous>)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97145
    at Array.forEach (<anonymous>)
    at a (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:96965)
    at /Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/chunks/5.js:12:97229
    at Array.forEach (<anonymous>)
    at l (/Users/filipjurkovic/Dev/izyPOS/izypos-dashboard/.next/server/ch
 ✓ Generating static pages (7/7)

> Export encountered errors on following paths:
    /_not-found
    /companies/page: /companies
    /page: /
    /tenants/page: /tenants

Since this I have tried to logically remove parts of the app and even switched to Daisy UI for testing and I have concluded that this is a Material Tailwind issues. I was wondering if anyone else is struggling with this issue and what have you done about it.

Kind regards, Filip Jurković

kelihansen commented 11 months ago

I just encountered a very similar issue. In my case, I upgraded to Next 13.5, and I'm getting Maximum call stack size exceeded when I try to build the project for production with the material-tailwind Dialog included.

Deeds67 commented 11 months ago

I have the same issue. I managed to work around it by using an older version of next

"next": "13.5.3",

Anything newer than that gives me the same Maximum call stack size exceeded error

kelihansen commented 11 months ago

I have the same issue. I managed to work around it by using an older version of next

"next": "13.5.3",

Anything newer than that gives me the same Maximum call stack size exceeded error

Thank you, 13.5.3 is working for me, as well

alexews commented 11 months ago

I've faced same issue

adrileo3 commented 11 months ago

I've faced this issue with Button component

schekutiev commented 11 months ago

I have the same problem since NextJs v 3.5.4. Downgrade is not the solution in my case, so I decided to drop material-tailwind...

JohnMwendwa commented 11 months ago

I had the same issue and downgraded to next@13.4.9 and don't run npm audit fix or npm audit fix --force after downgrading. This is just a temporary solution as I wait for @material-tailwind/react to be updated . You can check my code and the live production link at github-code & live-production-demo

kelihansen commented 11 months ago

I've been following https://github.com/vercel/next.js/issues/56614 - does the latest Next.js canary fix the issue for anyone? It does not for me.

NPJigaK commented 11 months ago

When using Material Tailwind, downgrading the next version to 13.5.3 solves the problem. 13.5.4 or higher will cause an error. v13.5.7-canary.9 as well.

kdy1 commented 10 months ago

Can you assign this issue to me?

alexewsv commented 10 months ago

I'm still faced this error with material-tailwind@2.1.4 + nextjs@13.5.6. but downgrade nextjs to 13.4.19 work well. More info: npm run dev is work well, but npm run build will raise error

@kdy1 I see the issue in nextjs repo is closed but, it seem not. btw thank your hard word.

kdy1 commented 10 months ago

@alexews v13.5.7-canary.16 will work.

alexewsv commented 10 months ago

@alexews v13.5.7-canary.16 will work.

Yeah, great, confirmed it works with v13.5.7-canary.16 and also latest v13.5.7-canary.25 without this regression ;)

aperepel commented 10 months ago

Thank you for capturing these details, folks. I ran into this, downgrading didn't help much, but v13.5.7-canary.25 works.

manojadams commented 6 months ago

I am facing this issue with following versions:

Note: Issue resolved after downgrading next version to 13.5.3

eri-prado commented 5 months ago

I'm facing this issue with the version: "next": "13.5.6"

Issue resolved after upgrading to version: "next": "14.1.0"

🇧🇷🇧🇷