title: npm start finishes with - FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory
body: <p>So I am trying to deploy my project to AWS LightSail instance</p>
  <ol>
  <li>I cloned my repo</li>
  <li>npm install</li>
  <li>npm start.<br />
  And then the Allocation failed Error happened</li>
  </ol>
  <p>Error:</p>
  <pre><code>&lt;--- JS stacktrace ---&gt;
  
   FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - 
   JavaScript heap out of memory
   1: 0xa222f0 node::Abort() [node]
   2: 0x96411f node::FatalError(char const*, char const*) [node]
   3: 0xb97f1e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) 
   [node]
   4: 0xb98297 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char 
   const*, bool) [node]
   5: 0xd52fd5  [node]
   6:  0xd83bbe v8::internal::EvacuateNewSpaceVisitor::Visit(v8::internal::HeapObject, 
   int) [node]
   7: 0xd8fbf6 v8::internal::FullEvacuator::RawEvacuatePage(v8::internal::MemoryChunk*, 
   long*) [node]
   8: 0xd7bd8f v8::internal::Evacuator::EvacuatePage(v8::internal::MemoryChunk*) [node]
   9: 0xd7c008 v8::internal::PageEvacuationTask::RunInParallel(v8::internal::ItemParallelJob::Task::Runner) [node]
   10: 0xd6e8e9 v8::internal::ItemParallelJob::Run() [node]
   11: 0xd91b50 void v8::internal::MarkCompactCollectorBase::CreateAndExecuteEvacuationTasks&lt;v8::internal::FullEvacuator, v8::internal::Mar
   kCompactCollector&gt;(v8::internal::MarkCompactCollector*, v8::internal::ItemParallelJob*, v8::internal::MigrationObserver*, long) [node]
   12: 0xd923ec v8::internal::MarkCompactCollector::EvacuatePagesInParallel() [node]
   13: 0xd925b5 v8::internal::MarkCompactCollector::Evacuate() [node]
   14: 0xda45b1 v8::internal::MarkCompactCollector::CollectGarbage() [node]
   15: 0xd60878 v8::internal::Heap::MarkCompact() [node]
   16: 0xd62368 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace,           v8::internal::GarbageCollectionReason, v8::GCCallbackFlag
   s) [node]
   17: 0xd657ac v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int,      v8::internal::AllocationType, v8::internal::AllocationOrigin, v
   8::internal::AllocationAlignment) [node]
   18: 0xd33e5b v8::internal::Factory::NewFillerObject(int, bool,      v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
   19: 0x107c5af v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
   20: 0x1423279  [node]
   npm ERR! code ELIFECYCLE
   npm ERR! errno 1
   npm ERR! gui@0.1.0 start: `react-scripts start`
   npm ERR! Exit status 1
   npm ERR! 
   npm ERR! Failed at the gui@0.1.0 start script.
   npm ERR! This is probably not a problem with npm. There is likely additional logging      output above.
  
   npm ERR! A complete log of this run can be found in:
   npm ERR!     /home/bitnami/.npm/_logs/2021-07-28T21_07_20_268Z-debug.log
  </code></pre>
  <p>So I investigated that error and most of the said to use:</p>
  <pre><code>export NODE_OPTIONS=--max_old_space_size=4096
  </code></pre>
  <p>So not the good side is that there is not error after setting the <strong>SPACE SIZE</strong>
  <strong>BUT</strong> the bad side is that it stays stuck on:</p>
  <pre><code>&gt; gui@0.1.0 start /opt/bitnami/apache/htdocs/GeThaText/frontend/gui
  &gt; react-scripts start
  Starting the development server...
  </code></pre>
  <p>My package.json:</p>
  <pre><code>{
  &quot;name&quot;: &quot;gui&quot;,
  &quot;version&quot;: &quot;0.1.0&quot;,
  &quot;private&quot;: true,
  &quot;dependencies&quot;: {
    &quot;@ant-design/icons&quot;: &quot;^4.2.1&quot;,
    &quot;@material-ui/core&quot;: &quot;^4.11.2&quot;,
    &quot;@material-ui/icons&quot;: &quot;^4.11.2&quot;,
    &quot;ant-design&quot;: &quot;^1.0.0&quot;,
    &quot;antd&quot;: &quot;^4.7.0&quot;,
    &quot;axios&quot;: &quot;^0.21.1&quot;,
    &quot;bootstrap&quot;: &quot;^4.5.2&quot;,
    &quot;dotenv&quot;: &quot;^10.0.0&quot;,
    &quot;material-table&quot;: &quot;^1.69.2&quot;,
    &quot;node-sass&quot;: &quot;^4.14.1&quot;,
    &quot;react&quot;: &quot;^16.14.0&quot;,
    &quot;react-copy-to-clipboard&quot;: &quot;^5.0.2&quot;,
    &quot;react-dom&quot;: &quot;^16.13.1&quot;,
    &quot;react-facebook-login&quot;: &quot;^4.1.1&quot;,
    &quot;react-google-login&quot;: &quot;^5.2.2&quot;,
    &quot;react-google-recaptcha&quot;: &quot;^2.1.0&quot;,
    &quot;react-redux&quot;: &quot;^7.2.1&quot;,
    &quot;react-router-config&quot;: &quot;^5.1.1&quot;,
    &quot;react-router-dom&quot;: &quot;^5.2.0&quot;,
    &quot;react-scripts&quot;: &quot;^3.4.2&quot;,
    &quot;react-text-loop&quot;: &quot;^2.3.0&quot;,
    &quot;redux&quot;: &quot;^4.0.5&quot;,
    &quot;redux-thunk&quot;: &quot;^2.3.0&quot;
  },
  &quot;scripts&quot;: {
    &quot;start&quot;: &quot;react-scripts start&quot;,
    &quot;build&quot;: &quot;react-scripts build&quot;,
    &quot;test&quot;: &quot;react-scripts test&quot;,
    &quot;eject&quot;: &quot;react-scripts eject&quot;
  },
  &quot;eslintConfig&quot;: {
  &quot;extends&quot;: &quot;react-app&quot;
  },
  &quot;browserslist&quot;: {
  &quot;production&quot;: [
    &quot;&gt;0.2%&quot;,
    &quot;not dead&quot;,
    &quot;not op_mini all&quot;
  ],
  &quot;development&quot;: [
    &quot;last 1 chrome version&quot;,
    &quot;last 1 firefox version&quot;,
    &quot;last 1 safari version&quot;
  ]
  },
  &quot;devDependencies&quot;: {
    &quot;eslint&quot;: &quot;^6.6.0&quot;,
    &quot;eslint-plugin-react&quot;: &quot;^7.24.0&quot;,
    &quot;less-loader&quot;: &quot;^6.2.0&quot;,
    &quot;sass&quot;: &quot;^1.34.1&quot;,
    &quot;sass-loader&quot;: &quot;^11.1.1&quot;
  }
  }
  </code></pre>
  <ul>
  <li>Repository: <a href="https://github.com/BenK93/GeThaText" rel="nofollow noreferrer">https://github.com/BenK93/GeThaText</a></li>
  <li>in the frontend directory of course :)</li>
  </ul>
  <p>Any Idea what might be the issue?  (on my computer Macbook M1 it works).
  P.S I tried using a simple react project and it worked perfectly</p>