NuxtN
Nuxt10mo ago
9 replies
Rejox

Reached heap limit Allocation failed - JavaScript heap out of memory

Hi, a few days ago I started making some content changes, and after building the site, it never completed the build anymore. Just out of nowhere, the build starts failing. I have tried a lot of solutions on the internet that did not work out unfortunately. I think it has something to do with any package that has updated, however I cannot verify this, or don't know how.

What I tried:

1. Tried adding this code block in my nuxt.config.ts (with NODE_ENV set to production)
  postcss: {
    plugins: {
      tailwindcss: {},
      autoprefixer: {},
      cssnano:
        process.env.NODE_ENV === 'production'
         ? { preset: ['default', { discardComments: { removeAll: true } }] }
            : false, // disable cssnano when not in production
     },
  }

2. Tried adding NODE_OPTIONS –max-old-space-size=4096 in .env

Both solutions do not work. This error is both on my localhost with pnpm run build, and on the netlify hosting when it builds the site.

Build (error)log added
message.txt27.03KB
Was this page helpful?