I’m trying to deploy my app but I’m getting this error:
7:13:48 PM: Creating an optimized production build…
7:19:46 PM: <— Last few GCs —>
7:19:46 PM: [1601:0x34475b0] 268332 ms: Mark-sweep 1310.1 (1473.5) -> 1310.0 (1474.0) MB, 2566.1 / 0.0 ms allocation failure GC in old space requested
7:19:46 PM: [1601:0x34475b0] 270627 ms: Mark-sweep 1310.0 (1474.0) -> 1310.0 (1439.5) MB, 2295.2 / 0.0 ms last resort GC in old space requested
7:19:46 PM: [1601:0x34475b0] 272972 ms: Mark-sweep 1310.0 (1439.5) -> 1310.0 (1438.5) MB, 2343.7 / 0.0 ms last resort GC in old space requested
7:19:46 PM: <— JS stacktrace —>
7:19:46 PM: ==== JS stack trace =========================================
7:19:46 PM: Security context: 0x25b78a425891
7:19:46 PM: 1: SourceMapGenerator_addMapping [/opt/build/repo/node_modules/source-map/lib/source-map-generator.js:~103] [pc=0x62502af81ca](this=0xe582536ad9 ,aArgs=0x1971587a9bd1 )
7:19:46 PM: 2: /* anonymous
/(aka /
anonymous
/) [/opt/build/repo/node_modules/terser/dist/bundle.min.js:~1] [pc=0x62502acc8a6](this=0x3887c40822d1 ,t=…
7:19:46 PM: FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
7:19:46 PM: 1:
7:19:46 PM: node::Abort() [/opt/buildhome/.nvm/versions/node/v8.16.0/bin/node]
7:19:46 PM: 2:
7:19:46 PM: 0x8cd14c [/opt/buildhome/.nvm/versions/node/v8.16.0/bin/node]
7:19:46 PM: 3:
7:19:46 PM: v8::Utils::ReportOOMFailure(char const
, bool) [/opt/buildhome/.nvm/versions/node/v8.16.0/bin/node]
7:19:46 PM: 4:
7:19:46 PM: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/opt/buildhome/.nvm/versions/node/v8.16.0/bin/node]
7:19:46 PM: 5:
7:19:46 PM: v8::internal:
:NewUninitializedFixedArray(int) [/opt/buildhome/.nvm/versions/node/v8.16.0/bin/node]
7:19:46 PM: 6:
7:19:46 PM: 0xd83553 [/opt/buildhome/.nvm/versions/node/v8.16.0/bin/node]
7:19:46 PM: 7:
7:19:46 PM: v8::internal::Runtime_GrowArrayElements(int, v8::internal::Object**, v8::internal::Isolate*) [/opt/buildhome/.nvm/versions/node/v8.16.0/bin/node]
7:19:46 PM: 8: 0x625021842fd
I have a similar problem, building a Gatsby site and getting error:
2:28:35 PM: <--- Last few GCs --->
2:28:35 PM: [1541:0x3bb00a0] 154094 ms: Mark-sweep 1351.5 (1425.5) -> 1350.8 (1428.0) MB, 3449.9 / 0.0 ms (average mu = 0.076, current mu = 0.007) allocation failure scavenge might not succeed
2:28:35 PM: <--- JS stacktrace --->
2:28:35 PM: ==== JS stack trace =========================================
2:28:35 PM: 0: ExitFrame [pc: 0x114d680dbe1d]
2:28:35 PM: Security context: 0x369735b1e6e9 <JSObject>
2:28:35 PM: 1: addMappingWithCode [0x2a57bba6f771] [/opt/build/repo/node_modules/webpack-sources/node_modules/source-map/lib/source-node.js:~150] [pc=0x114d692be575](this=0x078de248d481 <JSGlobal Object>,mapping=0x3605ff1e57b9 <Object map = 0x314af4c97809>,code=0x2a12adc6a431 <String[9]: 9633]}}},>)
2:28:35 PM: 2: /* anonymous */ [0x3d024199afc9] [/opt/build/repo/node_modul...
2:28:35 PM: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
2:28:35 PM: 1: 0x8f9d10 node::Abort() [node]
2:28:35 PM: 2: 0x8f9d5c [node]
2:28:35 PM: 3: 0xaffd0e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
2:28:35 PM: 4: 0xafff44 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
2:28:35 PM: 5: 0xef4152 [node]
2:28:35 PM: 6: 0xef4258 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [node]
2:28:35 PM: 7: 0xf00332 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]
2:28:35 PM: 8: 0xf00c64 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
2:28:35 PM: 9: 0xf038d1 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [node]
2:28:35 PM: 10: 0xeccd54 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [node]
2:28:35 PM: 11: 0x116cede v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [node]
2:28:35 PM: 12: 0x114d680dbe1d
2:28:42 PM: /usr/local/bin/build: line 34: 1541 Aborted (core dumped) gatsby build
These are effectively saying “Your build ran out of memory”. Node doesn’t handle that super well, in terms of “ok let me try scaling back” but instead just charges forward and eventually your build fails.
You’ll need to reduce memory usage. You need to aim for approximately 3Gb maximum for reliable builds. You’ll sometimes have more (depending on the number of other builds running simultaneously, which you have no control over or visibility into), but that’s the amount you can rely on and into which your build should fit on our Starter and Pro teams.
Enterprise teams have available custom build resources, where runtime, CPU, and memory available are adjustable.
In the case of gatsby @szokrika, it is likely that you use a poorly behaved plugin such as the ones mentioned in #5 in this article: 5 pro-tips and plugins for optimizing your Gatsby + Netlify site , so the fix for you may be as easy as finding the offending module and choosing not to use it.
Without more details such as a link to your build logs, @BrunoQuaresma, I couldn’t give you any similarly specific information since I don’t know what you’re using to build.
## Description
With Gatsby version 2.11.6 I can`t build a production version …of the app because it fails with out of memory exception while building (same on my machine and on Netlify). If I downgrade to version 2.10.5, build is working as expected.
### Steps to reproduce
Run `rimraf .cache public && gatsby build`
### Expected result
Build should succeed
### Actual result
Build fails with out of memory error :
⠦ Building production JavaScript and CSS bundles
<--- Last few GCs --->
[10733:0x10264e000] 241422 ms: Scavenge 1331.0 (1423.1) -> 1330.1 (1423.6) MB, 12.4 / 0.0 ms (average mu = 0.123, current mu = 0.086) allocation failure
[10733:0x10264e000] 241437 ms: Scavenge 1331.1 (1423.6) -> 1330.2 (1424.1) MB, 12.0 / 0.0 ms (average mu = 0.123, current mu = 0.086) allocation failure
[10733:0x10264e000] 241458 ms: Scavenge 1331.3 (1424.1) -> 1330.4 (1424.6) MB, 14.7 / 0.0 ms (average mu = 0.123, current mu = 0.086) allocation failure
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x2e6bd9b5be3d]
Security context: 0x261c7219e6e9 <JSObject>
1: /* anonymous */(aka /* anonymous */) [0x261c46282299] [/Users/ssijak/work/hocudabudem.fit/node_modules/gatsby/node_modules/@babel/core/lib/transformation/file/merge-map.js:~155] [pc=0x2e6bdaf5a89b](this=0x261c319822b1 <null>,m=0x261c8d43ed71 <Object map = 0x261cf880a9c9>)
2: arguments adaptor frame: 3->1
3: forEach [0x261c72186df1](this=0x261c...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x10003c597 node::Abort() [/Users/ssijak/.nvm/versions/node/v10.15.3/bin/node]
2: 0x10003c7a1 node::OnFatalError(char const*, char const*) [/Users/ssijak/.nvm/versions/node/v10.15.3/bin/node]
3: 0x1001ad575 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/ssijak/.nvm/versions/node/v10.15.3/bin/node]
4: 0x100579242 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/ssijak/.nvm/versions/node/v10.15.3/bin/node]
5: 0x10057bd15 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/Users/ssijak/.nvm/versions/node/v10.15.3/bin/node]
6: 0x100577bbf v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/Users/ssijak/.nvm/versions/node/v10.15.3/bin/node]
7: 0x100575d94 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/ssijak/.nvm/versions/node/v10.15.3/bin/node]
8: 0x10058262c v8::internal::Heap::AllocateRawWithLigthRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/Users/ssijak/.nvm/versions/node/v10.15.3/bin/node]
9: 0x1005826af v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/Users/ssijak/.nvm/versions/node/v10.15.3/bin/node]
10: 0x100551ff4 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/Users/ssijak/.nvm/versions/node/v10.15.3/bin/node]
11: 0x1007da044 v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/Users/ssijak/.nvm/versions/node/v10.15.3/bin/node]
12: 0x2e6bd9b5be3d
13: 0x2e6bdaf5a89b
/bin/sh: line 1: 10733 Abort trap: 6 gatsby build
error Command failed with exit code 134.
### Environment
System:
OS: macOS 10.14.5
CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
Yarn: 1.15.2 - ~/.nvm/versions/node/v10.15.3/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm
Languages:
Python: 2.7.10 - /usr/bin/python
Browsers:
Chrome: 75.0.3770.100
Safari: 12.1.1
npmPackages:
gatsby: 2.10.5 => 2.10.5
gatsby-awesome-pagination: ^0.3.4 => 0.3.4
gatsby-background-image: ^0.7.4 => 0.7.4
gatsby-image: ^2.2.3 => 2.2.3
gatsby-plugin-favicon: ^3.1.6 => 3.1.6
gatsby-plugin-feed: ^2.3.1 => 2.3.1
gatsby-plugin-google-tagmanager: ^2.1.0 => 2.1.0
gatsby-plugin-lunr: ^1.5.1 => 1.5.1
gatsby-plugin-manifest: ^2.2.0 => 2.2.0
gatsby-plugin-netlify: ^2.1.0 => 2.1.0
gatsby-plugin-netlify-cms: ^4.1.0 => 4.1.0
gatsby-plugin-offline: ^2.2.0 => 2.2.0
gatsby-plugin-postcss: ^2.1.0 => 2.1.0
gatsby-plugin-prefetch-google-fonts: ^1.4.2 => 1.4.2
gatsby-plugin-purgecss: ^4.0.0 => 4.0.0
gatsby-plugin-react-helmet: ^3.1.0 => 3.1.0
gatsby-plugin-robots-txt: ^1.4.0 => 1.4.0
gatsby-plugin-sharp: ^2.2.1 => 2.2.1
gatsby-plugin-sitemap: ^2.2.1 => 2.2.1
gatsby-remark-copy-linked-files: ^2.1.0 => 2.1.0
gatsby-remark-embed-video: ^1.7.1 => 1.7.1
gatsby-remark-images: ^3.1.2 => 3.1.2
gatsby-remark-relative-images: ^0.2.2 => 0.2.2
gatsby-remark-responsive-image: ^1.0.0-alpha13-alpha.435e0178 => 1.0.0-alpha13-alpha.435e0178
gatsby-source-filesystem: ^2.1.1 => 2.1.1
gatsby-transformer-remark: ^2.5.0 => 2.5.0
gatsby-transformer-sharp: ^2.2.0 => 2.2.0
npmGlobalPackages:
gatsby: 2.10.0