-
Notifications
You must be signed in to change notification settings - Fork 63
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
FATAL ERROR when building nuxt: JavaScript heap out of memory #226
Comments
I'm willing to try any patch in my workspace. |
Have you installed |
This was the same as me but hard to reproduce minimal reproduction. Is there any 1st thoughts on what to fix? Can't Build Production: error Command failed with signal "SIGKILL". on Update to 1.3.1 #215 |
Am new to Nuxt and Vue and bumped into this issue, too! I have been able to reproduce the issue with the latest versions of # Install dependencies
npx nuxi@latest init nuxt-icon --packageManager=npm --gitInit=no
cd nuxt-icon
npx nuxi module add icon
# Add an icon to app.vue
sed -i '/<NuxtWelcome/c\\t\t<Icon name="bi:sun" />' ./app.vue
# Build should succeed
npm run build # SUCCESS
# Install @iconify/json and observer out of memory error
npm i -D @iconify/json
npm run build # ERROR
# Update nuxt.config.ts to include only the Bootstrap Icons collection.
# The config should look similar to this:
# export default defineNuxtConfig({
# compatibilityDate: '2024-04-03',
# devtools: { enabled: true },
# modules: ["@nuxt/icon"],
# icon: {
# serverBundle: { collections: ["bi"] }
# },
# })
sed -i '/devtools: { enabled: true \}/c\ devtools: { enabled: true \},' ./nuxt.config.ts
sed -i '/modules: \["@nuxt\/icon"]/c\ modules: ["@nuxt/icon"],' ./nuxt.config.ts
sed -i '/\})/c\ icon: { collections: ["bi"] },\n}\)' ./nuxt.config.ts
# Build and observe out of memory error
npm run build # SUCCESS
# Sanity check: remove @iconify/json and building again should succeed
npm uninstall @iconify/json
npm run build # SUCCESS Additional context that may be useful: I originally came across the problem while I was trying to include some in the client bundle of my project ( It may be worth noting that I was able to build successfully with client bundling by adding only the specific dependencies I need from Edit: Edit 2: on the off chance that you do need everything in |
Thank you, @antfu! Those make sense and I also realised that I specified |
Can confirm removeing the @antfu should we close this issue now? |
Except it is not working for me, yet. It worked once, I think. I could have had some old version still. I tried to install the collections one-by-one and set up the serverBundle collections to get it working. Without the serverBundle setting it gives me this (with
|
I tried the
|
At this moment I have disabled the serverBundle. It is now building locally and in my CI. I noticed I had a
I tried removing that file, and re-installed deps, and then the error came back! After I re-installed everything with the |
I can confirm this issue as well. If you have a large iconset json, it will cause the memory issue.
this solves the issue for me: serverBundle: {
externalizeIconsJson: true,
}, |
The bug #158 is still acting up with 1.4.3.
I have a nuxt workspace where adding
@nuxt/icon
(1.4.3) and adding it to the modules causesnuxt build
to fail to theFATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
error. If I downgrade to 1.2.0 the error does not happen.The #158 was reportedly fixed but that code is after that refactored. Could it be broken, again?
The text was updated successfully, but these errors were encountered: