nuxt ssr build fail
----- Native stack trace -----
1: 00007FF6117F7DBF void cdecl node::OnFatalError(char const * ptr64,char const * ptr64)+1343
2: 00007FF61243B017 public: class v8::MaybeLocal<class v8::Object> cdecl v8::Function::NewInstance(class v8::Local<class v8::Context>,int,class v8::Local<class v8::Value> * ptr64 const)const ptr64+423
3: 00007FF61223B8C7 private: cdecl v8::base::AddressSpaceReservation::AddressSpaceReservation(void * ptr64,unsigned int64) ptr64+322071
4: 00007FF612239566 private: cdecl v8::base::AddressSpaceReservation::AddressSpaceReservation(void * ptr64,unsigned int64) ptr64+313014
5: 00007FF612253C1A X509_STORE_set_cleanup+5098
6: 00007FF61225F9F8 uv_timer_set_repeat+18968
7: 00007FF61227739C uv_timer_set_repeat+115644
8: 00007FF612277335 uv_timer_set_repeat+115541
9: 00007FF611F49F8B public: enum v8::RegExp::Flags cdecl v8::RegExp::GetFlags(void)const ptr64+16683
10: 00007FF611F49E5D public: enum v8::RegExp::Flags cdecl v8::RegExp::GetFlags(void)const ptr64+16381
11: 00007FF611F89A56 public: enum v8::RegExp::Flags cdecl v8::RegExp::GetFlags(void)const ptr64+277494
12: 00007FF611F8EE6E public: enum v8::RegExp::Flags cdecl v8::RegExp::GetFlags(void)const ptr64+299022
13: 00007FF611F8D720 public: enum v8::RegExp::Flags cdecl v8::RegExp::GetFlags(void)const ptr64+293056
14: 00007FF611F8AD9E public: enum v8::RegExp::Flags cdecl v8::RegExp::GetFlags(void)const ptr64+282430
15: 00007FF611F8A194 public: enum v8::RegExp::Flags cdecl v8::RegExp::GetFlags(void)const ptr64+279348
16: 00007FF611F89781 public: enum v8::RegExp::Flags cdecl v8::RegExp::GetFlags(void)const ptr64+276769
17: 00007FF611F895CF public: enum v8::RegExp::Flags cdecl v8::RegExp::GetFlags(void)const ptr64+276335
18: 00007FF611FE5652 public: enum v8::RegExp::Flags cdecl v8::RegExp::GetFlags(void)const ptr64+653298
19: 00007FF611FE5A5B public: enum
18 Replies
Hi @Zhaolin Lau. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the error you're experiencing with your Nuxt SSR build, this appears to be a Node.js native crash (indicated by the "Native stack trace" output). While the knowledge sources don't contain a direct match for this specific error, I can provide some guidance based on related SSR build issues documented in the Nuxt ecosystem.
Potential Solutions
1. Check Your Node.js Version
The native stack trace suggests a low-level Node.js issue. Based on related issues, Node.js version compatibility can cause SSR problems. Try:
- Using Node.js 18 LTS (known to be stable with Nuxt)
- Avoiding Node.js 19+ if you're experiencing issues
- Checking if you're using a compatible Node.js version for your Nuxt version
2. Dependency Issues
According to this GitHub issue, dependency conflicts can cause build failures. Try:
3. Docker-Specific Issues
If you're building in Docker, this Stack Overflow post mentions that missing
.dockerignore can cause problems by copying over node_modules. Ensure you have a proper .dockerignore file.
4. Memory Issues
Native crashes during SSR builds can indicate memory exhaustion. Try increasing Node.js memory:
Additional Information Needed
To better diagnose this issue, it would be helpful to know:
- Your Node.js version
- Your Nuxt version
- Whether this occurs locally or in a specific environment (Docker, CI/CD)
- Any recent changes to dependencies or configuration
If the issue persists, consider creating a minimal reproduction and reporting it as a GitHub issue to the Nuxt team.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@520675622830342144> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@kapa.ai it says FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
Let me check the knowledge base for you again. One moment! :books:
----------------------
Based on your error message "FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory", this confirms that your Nuxt SSR build is running out of memory during the build process.
Solutions
1. Increase Node.js Memory Limit (Immediate Fix)
Increase the heap size available to Node.js during the build:
You can adjust the value (4096 = 4GB). Try 8192 (8GB) if 4GB isn't enough.
2. Enable Memory Management Features
According to the Nuxt experimental features documentation, Nuxt has a
purgeCachedData feature that helps prevent memory leaks by automatically purging cached data. This is enabled by default in Nuxt 4, but you can explicitly enable it in Nuxt 3:
3. Check for Memory Leaks
Based on this Stack Overflow discussion, common causes of memory issues in Nuxt SSR include:
- Plugins not properly scoped - Ensure plugins don't create references that persist across requests
- Intervals/timers not cleaned up on the server-side
- Large data caching without proper cleanup
The GitHub PR #31379 mentions that payload caches were previously never cleared and just increased in memory, which has been addressed in newer Nuxt versions.
4. Optimize Your Build
- Reduce the size of your application by code-splitting
- Check if you're importing large libraries that could be lazy-loaded
- Review any large static data imports
5. Update Dependencies
According to this GitHub issue, there were memory leak issues in certain Vue versions (3.5.14-3.5.19). If you're using Nuxt 3.17-3.19, try pinning Vue to 3.5.13:
If these solutions don't resolve your issue, you may need to profile your application to identify specific memory-intensive operations during the build process.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@520675622830342144> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@kapa.ai im using nuxt 4.1.2, nuxt/cli 2.28.0, vueuse 13.9.0, vue 3.5.22
Let me check the knowledge base for you again. One moment! :books:
----------------------
Thank you for providing your version information. Based on your setup and the memory issue you're experiencing, here are some specific considerations:
Version-Specific Concerns
1. Nuxt CLI Version Issue
You mentioned you're using
nuxt/cli 2.28.0, but based on recent GitHub issues, there were significant problems with Nuxt CLI versions around 3.29.x that caused various issues including memory problems and hanging builds.
However, your CLI version (2.28.0) seems unusually low for Nuxt 4.1.2. The typical CLI version for Nuxt 4.x should be 3.x. You might want to verify this is correct:
If it's actually @nuxt/cli@3.28.0 or similar, that's more expected.
2. Vue Version Compatibility
You're using Vue 3.5.22, which is good. According to this memory leak issue, Vue versions 3.5.14-3.5.19 had memory leak problems, but 3.5.22 should be fine.
3. Nuxt 4.1.2 Considerations
Based on GitHub issues, Nuxt 4.1.3 had several issues that were later fixed. Since you're on 4.1.2, you're likely avoiding those specific problems, but you might still benefit from updating to the latest patch version after ensuring the CLI is correct.
Recommended Actions
1. Verify and update your CLI version:
2. Increase memory for the build:
3. Clean install:
Could you confirm your exact @nuxt/cli version? This will help narrow down if there's a version-specific issue affecting your build.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@520675622830342144> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@kapa.ai why i test on another project also showing warning like
ℹ Building Nuxt Nitro server (preset: node-server, compatibility date: 2024-07-22) nitro 11:44:36 PM
(node:31468) [DEP0155] DeprecationWarning: Use of deprecated trailing slash pattern mapping "./" in the "exports" field module resolution of the package at C:\Users\zhaol\Projects\UMPSA-Hackathon\node_modules.pnpm@nuxt+icon@2.1.0_magicast@0_9a15db959b00ec7020cb1cff935dc8c9\node_modules@iconify\utils\package.json imported from C:\Users\zhaol\Projects\UMPSA-Hackathon\node_modules.pnpm@nuxt+icon@2.1.0_magicast@0_9a15db959b00ec7020cb1cff935dc8c9\node_modules@nuxt\icon\dist\runtime\server\api.js. Mapping specifiers ending in "/" is no longer supported.
(Use
node --trace-deprecation ... to show where the warning was created)
(node:31468) [DEP0155] DeprecationWarning: Use of deprecated trailing slash pattern mapping "./" in the "exports" field module resolution of the package at C:\Users\zhaol\Projects\UMPSA-Hackathon\node_modules@iconify\utils\package.json imported from C:\Users\zhaol\Projects\UMPSA-Hackathon\node_modules. Mapping specifiers ending in "/" is no longer supported.
(node:31468) [DEP0155] DeprecationWarning: Use of deprecated trailing slash pattern mapping "./" in the "exports" field module resolution of the package at C:\Users\zhaol\Projects\UMPSA-Hackathon\node_modules@vue\shared\package.json imported from C:\Users\zhaol\Projects\UMPSA-Hackathon\node_modules\nuxt\dist\core\runtime\nitro\templates\error-500.js. Mapping specifiers ending in "/" is no longer supported.Let me check the knowledge base for you again. One moment! :books:
----------------------
Based on the deprecation warnings you're seeing, this is a Node.js deprecation warning related to how packages define their exports in
package.json. This is not a critical error but a warning about deprecated patterns.
What's Happening
The warning [DEP0155] DeprecationWarning: Use of deprecated trailing slash pattern mapping "./" in the "exports" field indicates that some packages in your dependencies (@iconify/utils, @vue/shared, and @nuxt/icon) are using an outdated pattern for the exports field in their package.json.
According to the Nuxt ESM documentation, Node.js uses the exports field for module resolution. The trailing slash pattern ("./") in exports mappings is now deprecated in newer Node.js versions.
Why You're Seeing This
Based on PR #32755, there have been efforts to add trailing slashes to directory aliases in Nuxt, but the deprecation warning you're seeing is actually about the package.json exports field in your dependencies, not Nuxt's internal aliases.
Solutions
1. This is Not Your Problem to Fix
These warnings come from upstream packages (@iconify/utils, @vue/shared, @nuxt/icon). The package maintainers need to update their package.json exports field to remove the trailing slash pattern.
2. Safe to Ignore (For Now)
These are deprecation warnings, not errors. Your build will still work. Node.js is warning that this pattern will be removed in future versions, but it's still supported currently.
3. Suppress the Warnings (Optional)
If the warnings are cluttering your output, you can suppress them:
Or for development:
4. Update Dependencies
Try updating to the latest versions of the affected packages:
The maintainers may have already fixed this in newer versions.
5. Check Node.js Version
These warnings are more prominent in newer Node.js versions (20+). If you're using Node.js 22 or later, you might see more of these warnings as Node.js becomes stricter about deprecated patterns.
Related Context
Similar to the YouTube video about dependency warnings, these deprecation warnings in fresh Nuxt applications are often from nested dependencies and don't typically affect your application's functionality in production.
Bottom line: These warnings are informational and don't indicate a problem with your code or build. They're reminders for package maintainers to update their export patterns.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@520675622830342144> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@kapa.ai why it takes so long to build?
Let me check the knowledge base for you again. One moment! :books:
----------------------
Based on the knowledge sources and your previous context about memory issues and Windows environment, here are the main reasons why your Nuxt build might be taking so long:
1. Windows Performance Issues
According to this documentation PR, HMR (Hot Module Replacement) performance on Windows can be extremely slow, with reload times ranging from 20 to 30 seconds, and even exceeding a minute for larger projects.
Solution: The recommended approach is to use WSL (Windows Subsystem for Linux) with a distribution like Ubuntu. This can reduce reload times to under a second and avoid multiple restarts, providing a smoother development experience.
2. Memory Constraints
Given your earlier memory issues ("JavaScript heap out of memory"), if your build is struggling with memory allocation, it will significantly slow down the build process as Node.js tries to manage limited memory resources.
Solution: Ensure you're running with increased memory:
3. Common Performance Problems
According to the Nuxt performance best practices, slow builds can be caused by:
- Overusing plugins - Plugins that require expensive computations or take too long to initialize
- Unused code/dependencies - Unnecessary dependencies increase bundle size
- Loading everything at once - Not properly optimizing what gets loaded when
4. Build Optimization Options
Based on this YouTube video about faster builds, you can potentially speed up production builds by switching to Rolldown-Vite, which can provide significant performance improvements.
Additionally, this video about build caching mentions using the
nuxt-build-cache module for faster re-builds and deploys.
Immediate Actions
1. Consider using WSL if you're on Windows (most impactful for development)
2. Increase Node.js memory as mentioned earlier
3. Clean your build artifacts:
4. Check for unused dependencies in your package.json
Could you clarify if you're experiencing slow development builds (during npm run dev) or production builds (during npm run build)? This will help provide more specific guidance.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@520675622830342144> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@Zhaolin Lau i have the same issue in the new version of nuxt. What fixed it for me is to go back to an older version. "nuxt": "4.1.3". i have this now in my package.json
I dont know where this memory leak comes from at the moment.
are you sure you are on 4.1.2? and not on ^4.1.2?
@BeerDuck im using 4.1.2
Maybe try a few more versions down?
https://github.com/nuxt/nuxt/issues/33570 (just found this ticket about the problem)
GitHub
Can't build on Windows · Issue #33570 · nuxt/nuxt
Environment Operating System: Windows_NT Node Version: v24.10.0 Nuxt Version: 4.2.0 CLI Version: 3.29.3 Nitro Version: 2.12.8 Package Manager: npm@11.6.2 Builder: - User Config: devtools, typescrip...