New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nuxt generate FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory #14168
Comments
Thanks! Would you provide a reproduction? 🙏 |
@danielroe https://stackblitz.com/edit/github-fsjrqu?file=nuxt.config.ts seems like not having a
so the error is different than on my local repo... but maybe because the repo is bigger it just takes longer and therefor uses more memory trying to build |
Having the same issue when i upgrade to |
Same here, but only in CI using GitHub Actions and using Netlify CLI to build, see https://github.com/nuxt/framework/discussions/1799#discussioncomment-3033754 |
Im having this issue both locally and with Cloudflare's automated build system on rc6 |
However, I still cannot reproduce this with the updated reproduction. But, I think we can tentatively suggest that this might be an issue with rollup, which takes a fair amount of memory when compiling. In the original issue reporter's case, it's not vite but the nitro rollup build, but still this issue is relevant: vitejs/vite#2433 (comment). You might try disabling sourcemaps: export default defineNuxtConfig({
sourcemap: false
}) |
Not reproducable by @danielroe, welp, let's close this! Gotta bring that issue count down my nuxt friends 💚 |
It is still happening, when run
or sourcemap: {
client: true,
server: false
} My nuxt config: import { sentryVitePlugin } from "@sentry/vite-plugin";
require("custom-env").env(true);
function removeDataTestAttrs(node: any, _context: any) {
if (node.type === 1 /* NodeTypes.ELEMENT */) {
node.props = node.props.filter((prop: any) =>
prop.type === 6 /* NodeTypes.ATTRIBUTE */
? prop.name !== "data-testid"
: true
);
}
}
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
dev: process.env.NODE_ENV !== "production",
ssr: false,
sourcemap: {
client: true,
server: false,
},
modules: ["@nuxtjs/i18n", "@pinia/nuxt"],
components: [
{
path: "~/components/",
pathPrefix: false,
},
],
i18n: {
vueI18n: {
legacy: false,
locale: "en",
messages: {
// TODO: Verificar que sea la forma correcta de importar
en: require("./locales/en.json"),
},
},
},
vite: {
plugins: [
{
...sentryVitePlugin({
org: 'some',
project: 'some',
include: './dist',
ignore: ['node_modules'] // Auth tokens can be obtained from https://sentry.io/settings/account/api/auth-tokens/
// and needs the `project:releases` and `org:read` scopes
//authToken: env.VITE_SENTRY_AUTH_TOKEN,
}),
apply(_config, _ctx) {
return process.env.NODE_ENV !== 'development'
}
}
],
css: {
preprocessorOptions: {
scss: {
additionalData: '@use "@/assets/css/app.scss" as *;',
},
},
},
define: {
"window.global": {},
},
vue: {
template: {
compilerOptions: {
nodeTransforms:
process.env.NODE_ENV == "production" ? [removeDataTestAttrs] : [],
},
},
},
},
router: {
options: { hashMode: true },
},
}); Error output:
I have to set sourcemap values as false in both cases in order to get work, but i need the sourcemaps to upload them to my sentry instance. 😢 |
Any update on this issue? |
If you can provide a reproduction, we can reopen and investigate. |
The strange thing is that it doesn't happen on a local machine, only within a Github Action environment. Using |
Probably because GitHub Actions has a limit of 7Gb - see https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L4-L6 for example. |
I also get it building on Digital Ocean when I enable client source maps. Locally build works. |
this helped me |
Any updates 😒 |
We're also getting this error when trying to prerender our site. Setting NODE_OPTIONS="--max_old_space_size= 8192" doesn't appear to help at all. |
Not sure if this is a real fix or just coincidence, but I solved it in my case by reducing the I know that for instance for postgres it just crashes if you reach the memory limit of the machine. Might this be a similar issue? |
For others who may be in my boat - (Nuxt 3.6.1). Even though I have 64GB memory and nothing else running, I got this error building locally for production as well as on Netlify. I noticed in my logs that the final I hadn't yet cleaned up my project for production. I had all the Font Awesome libraries available and all were being transpiled (as configured in I hope this helps someone, including my future self. |
Hey, how do you exclude libraries that you don't want to be transpiled? |
It's not excluding per se. It's simply removing them from the transpile block in Example:
Above I've commented the libraries out. I'll remove them before production. HTH, |
Still have the same problem. I tried changing the
Is this P.S
|
Environment
Nuxt CLI v3.0.0-rc.4
Nuxt project info:
Darwin
v16.14.2
3.0.0-rc.3
yarn@1.22.17
vite
runtimeConfig
,build
,css
,buildModules
,modules
,sanity
,vite
@nuxtjs/sanity@1.2.2
,@vueuse/nuxt@8.6.0
@pinia/nuxt@0.1.9
,@safesoftware/safebase-vue/nuxt@0.4.0
Reproduction
yarn nuxt build
Describe the bug
when trying to generate my site i get javascript heap allocation errors.
it hangs on
ℹ Initializing prerenderer
for a long timemy devops colleague said he had it running for the hour, and it finally failed (see logs).
Additional context
No response
Logs
The text was updated successfully, but these errors were encountered: