How can I solve next.js 13.5 latest error with material-tailwind?
Asked Answered
C

1

6

This is a simple error, am created a next.js 13.5 latest project. and then install material-tailwind. then for testing when am use Just click me from material, in development mode it's running perfectly..but when am using yarn build or hosting vercel, it's showing error. and when am removing components imported from material-tailwind, it's perfectly running in development mode and also building and deploying perfectly..but again if I import any component from material-tailwind, it's working perfectly in development mode, but when trying to build, it's giving error, this is error,

yarn run v1.22.19
$ next build
 ✓ Creating an optimized production build    
 ✓ Compiled successfully
 ✓ Linting and checking validity of types    
 ✓ Collecting page data    
   Generating static pages (4/5)  [==  ] 
RangeError: Maximum call stack size exceeded
    at P (/home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:66159)
    at l (/home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:61350)
    at /home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:62551
    at Array.forEach (<anonymous>)
    at /home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:62524
    at Array.forEach (<anonymous>)
    at a (/home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:62344)
    at /home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:62608
    at Array.forEach (<anonymous>)
    at l (/home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:62301)

Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
RangeError: Maximum call stack size exceeded
    at P (/home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:66159)
    at l (/home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:61350)
    at /home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:62551
    at Array.forEach (<anonymous>)
    at /home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:62524
    at Array.forEach (<anonymous>)
    at a (/home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:62344)
    at /home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/chunks/490.js:10:62608
    at Array.forEach (<anonymous>)
    at l (/home/abdullah/projects/next/fleet/fleet-frontend-2nd/.next/server/c
 ✓ Generating static pages (5/5) 

> Export encountered errors on following paths:
        /page: /
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

and this is my testing code in page.js file

"use client";

import { Button } from "@material-tailwind/react";

const Home = () => {
    return (
        <main>
            <Button>Click me</Button>
        </main>
    );
};

export default Home;

Carillo answered 10/10, 2023 at 10:21 Comment(3)
i am also facing this same issue todayReahard
This issue made me stay in office at friday night ....Pelorus
Same here, its a headache, trying to find the proper version,Distress
A
0

Let me preface this with I know this doesn't 100% solve your issue, but it might help patch it for now until an official fix is released.

This seems to be related to the Next.js version 13.5 - the same thing is happening to me. I spent hours today trying to figure out a solution - a lot of others said to add a --stack-size=_____ limit increase but that wouldn't work for me. Ultimately downgrading my version worked flawlessly and it built the first time.

To do so:

  1. Completely delete your node_modules folder using rm -r node_modules on the command line. (You shouldn't need to delete your .next folder, but if this doesn't work, delete that too.)
  2. In your package.json, set the next version to something other than 13.5.X - I used 13.4.19 since that was my last stable release.
  3. Run npm install from the command line
  4. Re-run your build, it should build successfully if you aren't using v13.5

Hopefully, that helps you get up and running until it is officially fixed!

Autography answered 16/10, 2023 at 2:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.