create-react-app: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory -\node_modules\typescript\lib\typescript.js

Recently I migrated mine react project to typescript with CRA. After a while, builds became slower. (around 300s for the build) Lastly when I converted the following file from .js to .ts: I discovered that with findQuestion() code compiles in more than 1000 s. but if I add FilterQuestions() I get Ineffective mark-compacts near heap allocation failed! To mention that the project starts and runs even if typescript code is not compiled.

//.... imports

const _properties = types.model({
  template_uuid: types.identifier,
  title: "",
  description: "",
  style: "",
  external_key: types.optional(types.model("template_ext_key", {
      actno: 0,
      soknadId: 0
    }),{})
});

export const Schema = types.model("Schema", {
   //... a lot of fields
    questions: types.optional(types.array(UnionQuestions),[]),
    consent_templates: types.optional(types.array(ConsentTemplate), [])
  })
  .views(self =>({
   //method below throws   Ineffective mark-compacts near heap allocation failed when try to build
    **filterQuestions(question_uuid:string){
      let questions = self.questions.filter(q => q.properties.question_uuid !== question_uuid)
     
      return questions
    },**
    // method below drastically slows down the build 
    findQuestion(question_uuid:string){
      
      const question = self.questions.find(q=>{
       
        return q.properties.question_uuid === question_uuid
      })
     return question
    },
    isAccessibleForPatient:()=>return self.accessible === "patient",
    accessibleFor()=>return self.accessible
    
  }))
  .actions(self => ({
    // ... it works with this block
  }));

my package.json file:

{
  "name": "adopus-portal-typescript",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@material-ui/core": "^4.8.3",
    "@material-ui/icons": "^4.5.1",
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.3.2",
    "@testing-library/user-event": "^8.0.3",
    "@trendmicro/react-sidenav": "^0.5.0",
    "@types/jest": "^24.0.0",
    "@types/node": "^13.1.6",
    "@types/react": "^16.9.0",
    "@types/react-dom": "^16.9.0",
    "@types/react-router-dom": "^5.1.3",
    "@types/uuid": "^3.4.7",
    "all": "^0.0.0",
    "antd": "^3.26.6",
    "apollo-boost": "^0.4.7",
    "apollo-cache": "^1.3.4",
    "apollo-client": "^2.6.8",
    "apollo-link": "^1.2.13",
    "apollo-utilities": "^1.3.3",
    "axios": "^0.19.1",
    "graphql": "^14.5.8",
    "immer": "^5.3.2",
    "js-sha256": "^0.9.0",
    "lodash": "^4.17.15",
    "mobx": "^5.15.2",
    "mobx-react-lite": "^1.5.2",
    "mobx-state-tree": "^3.15.0",
    "moment": "^2.24.0",
    "rc-datepicker": "^5.0.15",
    "react": "^16.12.0",
    "react-apollo": "^3.1.3",
    "react-bootstrap": "^1.0.0-beta.16",
    "react-dom": "^16.12.0",
    "react-outside-click-handler": "^1.3.0",
    "react-reveal": "^1.2.2",
    "react-router-dom": "^5.1.2",
    "react-scripts": "3.3.0",
    "react-select": "^3.0.8",
    "regexpp": "^3.0.0",
    "sweetalert2": "^9.5.4",
    "typescript": "^3.7.5",
    "use-immer": "^0.3.5",
    "uuid": "^3.3.3"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "tslint": "^5.20.1",
    "tslint-config-prettier": "^1.18.0",
    "tslint-react": "^4.1.0"
  }
}

tsconfig.json file:

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "noImplicitReturns": true,
    "jsx": "react"
  },
  "include": [
    "src"   
  ]
}

this is the cli output:

yarn run v1.21.1
$ react-scripts build
Creating an optimized production build...

<--- Last few GCs --->
tart of marking 1124 ms) (average mu = 0.195, current mu = 0.080) [6860:000002C85ACEDC20]  1596665 ms: Mark-sweep 2044.5 (2054.5) -> 2042.1 (2053.8) MB, 733.4 / 0.0 ms  (+ 224.1 ms in 50 steps since start of marking, biggest step 9.4 ms, walltime since start of marking 985 ms) (average mu = 0.127, current mu = 0.028) al[6860:000002C85ACEDC20]  1598454 ms: Mark-sweep 2043.3 (2053.8) -> 2042.4 (2053.0) MB, 1783.0 / 0.0 ms  (average mu = 0.053, current mu = 0.003) allocation failure scavenge might not succeed


<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 00007FF77E87404D]
Security context: 0x03fa58ec08a1 <JSObject>
    1: write [000002A62B1C4569] [C:\Sites\adopus-portal\node_modules\typescript\lib\typescript.js:~12994] [pc=00000314C50E377B](this=0x02a62b1c1f01 <Object map = 00000217F49B5C21>,0x0132154d1ac9 <String[#1]: :>)
    2: writePunctuation(aka writePunctuation) [000001970EAC5D79] [C:\Sites\adopus-portal\node_modules\typescript\lib\typescript.js:~93092] [pc=000...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Writing Node.js report to file: report.20200201.190457.6860.0.001.json
Node.js report completed
 1: 00007FF77DCA124F napi_wrap+124431
 2: 00007FF77DC42A06 public: bool __cdecl v8::base::CPU::has_sse(void)const __ptr64+34502
 3: 00007FF77DC436C6 public: bool __cdecl v8::base::CPU::has_sse(void)const __ptr64+37766
 4: 00007FF77E4482DE private: void __cdecl v8::Isolate::ReportExternalAllocationLimitReached(void) __ptr64+94
 5: 00007FF77E430321 public: class v8::SharedArrayBuffer::Contents __cdecl v8::SharedArrayBuffer::Externalize(void) __ptr64+833
 6: 00007FF77E2FDBEC public: static void __cdecl v8::internal::Heap::EphemeronKeyWriteBarrierFromCode(unsigned __int64,unsigned __int64,class v8::internal::Isolate * __ptr64)+1436
 7: 00007FF77E308F90 public: void __cdecl v8::internal::Heap::ProtectUnprotectedMemoryChunks(void) __ptr64+1312
 8: 00007FF77E305AC4 public: static bool __cdecl v8::internal::Heap::PageFlagsAreConsistent(class v8::internal::HeapObject)+3204
 9: 00007FF77E2FB353 public: bool __cdecl v8::internal::Heap::CollectGarbage(enum v8::internal::AllocationSpace,enum v8::internal::GarbageCollectionReason,enum v8::GCCallbackFlags) __ptr64+1283
10: 00007FF77E2F9B24 public: void __cdecl v8::internal::Heap::AddRetainedMap(class v8::internal::Handle<class v8::internal::Map>) __ptr64+2356
11: 00007FF77E31ADF5 public: class v8::internal::Handle<class v8::internal::HeapObject> __cdecl v8::internal::Factory::NewFillerObject(int,bool,enum v8::internal::AllocationType) __ptr64+53
12: 00007FF77E086E19 ??4iterator@JumpTableTargetOffsets@interpreter@internal@v8@@QEAAAEAV01234@$$QEAV01234@@Z+4057
13: 00007FF77E87404D public: virtual bool __cdecl v8::internal::SetupIsolateDelegate::SetupHeap(class v8::internal::Heap * __ptr64) __ptr64+567949
14: 00000314C50E377B
Done in 1623.07s.

this is report issued report.20200201.190457.6860.0.001.json:

{
  "header": {
    "reportVersion": 1,
    "event": "Allocation failed - JavaScript heap out of memory",
    "trigger": "FatalError",
    "filename": "report.20200201.190457.6860.0.001.json",
    "dumpEventTime": "2020-02-01T19:04:57Z",
    "dumpEventTimeStamp": "1580580297811",
    "processId": 6860,
    "cwd": "C:\\Sites\\adopus-portal",
    "commandLine": [
      "C:\\Program Files\\nodejs\\node.exe",
      "--max-old-space-size=2048",
      "C:\\Sites\\adopus-portal\\node_modules\\fork-ts-checker-webpack-plugin\\lib\\service.js"
    ],
    "nodejsVersion": "v12.13.1",
    "wordSize": 64,
    "arch": "x64",
    "platform": "win32",
    "componentVersions": {
      "node": "12.13.1",
      "v8": "7.7.299.13-node.16",
      "uv": "1.33.1",
      "zlib": "1.2.11",
      "brotli": "1.0.7",
      "ares": "1.15.0",
      "modules": "72",
      "nghttp2": "1.39.2",
      "napi": "5",
      "llhttp": "1.1.4",
      "http_parser": "2.8.0",
      "openssl": "1.1.1d",
      "cldr": "35.1",
      "icu": "64.2",
      "tz": "2019c",
      "unicode": "12.1"
    },
    "release": {
      "name": "node",
      "lts": "Erbium",
      "headersUrl": "https://nodejs.org/download/release/v12.13.1/node-v12.13.1-headers.tar.gz",
      "sourceUrl": "https://nodejs.org/download/release/v12.13.1/node-v12.13.1.tar.gz",
      "libUrl": "https://nodejs.org/download/release/v12.13.1/win-x64/node.lib"
    },
    "osName": "Windows_NT",
    "osRelease": "10.0.17134",
    "osVersion": "Windows 10 Enterprise",
    "osMachine": "x86_64",
    "cpus": [
      {
        "model": "Intel(R) Core(TM) i7-5700HQ CPU @ 2.70GHz",
        "speed": 2694,
        "user": 2950421,
        "nice": 0,
        "sys": 2462468,
        "idle": 14204578,
        "irq": 294921
      },
      {
        "model": "Intel(R) Core(TM) i7-5700HQ CPU @ 2.70GHz",
        "speed": 2694,
        "user": 1684500,
        "nice": 0,
        "sys": 1303453,
        "idle": 16629234,
        "irq": 32421
      },
      {
        "model": "Intel(R) Core(TM) i7-5700HQ CPU @ 2.70GHz",
        "speed": 2694,
        "user": 3180984,
        "nice": 0,
        "sys": 2659421,
        "idle": 13776781,
        "irq": 23187
      },
      {
        "model": "Intel(R) Core(TM) i7-5700HQ CPU @ 2.70GHz",
        "speed": 2694,
        "user": 1956890,
        "nice": 0,
        "sys": 1418218,
        "idle": 16242078,
        "irq": 15515
      },
      {
        "model": "Intel(R) Core(TM) i7-5700HQ CPU @ 2.70GHz",
        "speed": 2694,
        "user": 3539625,
        "nice": 0,
        "sys": 2513015,
        "idle": 13564546,
        "irq": 27265
      },
      {
        "model": "Intel(R) Core(TM) i7-5700HQ CPU @ 2.70GHz",
        "speed": 2694,
        "user": 2563375,
        "nice": 0,
        "sys": 1366000,
        "idle": 15687812,
        "irq": 20093
      },
      {
        "model": "Intel(R) Core(TM) i7-5700HQ CPU @ 2.70GHz",
        "speed": 2694,
        "user": 3668296,
        "nice": 0,
        "sys": 2280281,
        "idle": 13668609,
        "irq": 17859
      },
      {
        "model": "Intel(R) Core(TM) i7-5700HQ CPU @ 2.70GHz",
        "speed": 2694,
        "user": 2599343,
        "nice": 0,
        "sys": 2430656,
        "idle": 14587171,
        "irq": 40656
      }
    ],
    "networkInterfaces": [
      {
        "name": "vEthernet (DockerNAT)",
        "internal": false,
        "mac": "00:15:5d:8b:e1:4f",
        "address": "fe80::8d3c:6d13:744f:d396",
        "netmask": "ffff:ffff:ffff:ffff::",
        "family": "IPv6",
        "scopeid": 28
      },
      {
        "name": "vEthernet (DockerNAT)",
        "internal": false,
        "mac": "00:15:5d:8b:e1:4f",
        "address": "10.0.75.1",
        "netmask": "255.255.255.0",
        "family": "IPv4"
      },
      {
        "name": "VirtualBox Host-Only Network",
        "internal": false,
        "mac": "0a:00:27:00:00:14",
        "address": "fe80::11be:a0dc:4b53:b244",
        "netmask": "ffff:ffff:ffff:ffff::",
        "family": "IPv6",
        "scopeid": 20
      },
      {
        "name": "VirtualBox Host-Only Network",
        "internal": false,
        "mac": "0a:00:27:00:00:14",
        "address": "192.168.56.1",
        "netmask": "255.255.255.0",
        "family": "IPv4"
      },
      {
        "name": "Npcap Loopback Adapter",
        "internal": false,
        "mac": "02:00:4c:4f:4f:50",
        "address": "fe80::748c:9f80:f780:85a4",
        "netmask": "ffff:ffff:ffff:ffff::",
        "family": "IPv6",
        "scopeid": 19
      },
      {
        "name": "Npcap Loopback Adapter",
        "internal": false,
        "mac": "02:00:4c:4f:4f:50",
        "address": "169.254.133.164",
        "netmask": "255.255.0.0",
        "family": "IPv4"
      },
      {
        "name": "Wi-Fi",
        "internal": false,
        "mac": "34:02:86:af:6a:31",
        "address": "2001:4643:b60e:0:6c6b:ee20:1e3d:7183",
        "netmask": "ffff:ffff:ffff:ffff::",
        "family": "IPv6",
        "scopeid": 0
      },
      {
        "name": "Wi-Fi",
        "internal": false,
        "mac": "34:02:86:af:6a:31",
        "address": "2001:4643:b60e:0:c175:6813:9862:6005",
        "netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
        "family": "IPv6",
        "scopeid": 0
      },
      {
        "name": "Wi-Fi",
        "internal": false,
        "mac": "34:02:86:af:6a:31",
        "address": "fe80::6c6b:ee20:1e3d:7183",
        "netmask": "ffff:ffff:ffff:ffff::",
        "family": "IPv6",
        "scopeid": 29
      },
      {
        "name": "Wi-Fi",
        "internal": false,
        "mac": "34:02:86:af:6a:31",
        "address": "10.0.0.7",
        "netmask": "255.255.255.0",
        "family": "IPv4"
      },
      {
        "name": "Loopback Pseudo-Interface 1",
        "internal": true,
        "mac": "00:00:00:00:00:00",
        "address": "::1",
        "netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
        "family": "IPv6",
        "scopeid": 0
      },
      {
        "name": "Loopback Pseudo-Interface 1",
        "internal": true,
        "mac": "00:00:00:00:00:00",
        "address": "127.0.0.1",
        "netmask": "255.0.0.0",
        "family": "IPv4"
      },
      {
        "name": "vEthernet (Default Switch)",
        "internal": false,
        "mac": "62:15:ca:30:86:01",
        "address": "fe80::f02f:675e:d44d:4be5",
        "netmask": "ffff:ffff:ffff:ffff::",
        "family": "IPv6",
        "scopeid": 4
      },
      {
        "name": "vEthernet (Default Switch)",
        "internal": false,
        "mac": "62:15:ca:30:86:01",
        "address": "172.21.88.193",
        "netmask": "255.255.255.240",
        "family": "IPv4"
      }
    ],
    "host": "igorPC"
  },
  "javascriptStack": {
    "message": "No stack.",
    "stack": [
      "Unavailable."
    ]
  },
  "nativeStack": [
    {
      "pc": "0x00007ff77db51729",
      "symbol": "std::basic_ostream<char,std::char_traits<char> >::operator<<+10873"
    },
    {
      "pc": "0x00007ff77db55b4c",
      "symbol": "std::basic_ostream<char,std::char_traits<char> >::operator<<+28316"
    },
    {
      "pc": "0x00007ff77db54b08",
      "symbol": "std::basic_ostream<char,std::char_traits<char> >::operator<<+24152"
    },
    {
      "pc": "0x00007ff77dc4369b",
      "symbol": "v8::base::CPU::has_sse+37723"
    },
    {
      "pc": "0x00007ff77e4482de",
      "symbol": "v8::Isolate::ReportExternalAllocationLimitReached+94"
    },
    {
      "pc": "0x00007ff77e430321",
      "symbol": "v8::SharedArrayBuffer::Externalize+833"
    },
    {
      "pc": "0x00007ff77e2fdbec",
      "symbol": "v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1436"
    },
    {
      "pc": "0x00007ff77e308f90",
      "symbol": "v8::internal::Heap::ProtectUnprotectedMemoryChunks+1312"
    },
    {
      "pc": "0x00007ff77e305ac4",
      "symbol": "v8::internal::Heap::PageFlagsAreConsistent+3204"
    },
    {
      "pc": "0x00007ff77e2fb353",
      "symbol": "v8::internal::Heap::CollectGarbage+1283"
    },
    {
      "pc": "0x00007ff77e2f9b24",
      "symbol": "v8::internal::Heap::AddRetainedMap+2356"
    },
    {
      "pc": "0x00007ff77e31adf5",
      "symbol": "v8::internal::Factory::NewFillerObject+53"
    },
    {
      "pc": "0x00007ff77e086e19",
      "symbol": "v8::internal::interpreter::JumpTableTargetOffsets::iterator::operator=+4057"
    },
    {
      "pc": "0x00007ff77e87404d",
      "symbol": "v8::internal::SetupIsolateDelegate::SetupHeap+567949"
    },
    {
      "pc": "0x00000314c50e377b",
      "symbol": ""
    }
  ],
  "javascriptHeap": {
    "totalMemory": 2156163072,
    "totalCommittedMemory": 2156163072,
    "usedMemory": 2141806824,
    "availableMemory": 46371648,
    "memoryLimit": 2197815296,
    "heapSpaces": {
      "read_only_space": {
        "memorySize": 262144,
        "committedMemory": 262144,
        "capacity": 261872,
        "used": 32296,
        "available": 229576
      },
      "new_space": {
        "memorySize": 4194304,
        "committedMemory": 4194304,
        "capacity": 2094976,
        "used": 200552,
        "available": 1894424
      },
      "old_space": {
        "memorySize": 2113777664,
        "committedMemory": 2113777664,
        "capacity": 2104971224,
        "used": 2104470776,
        "available": 500448
      },
      "code_space": {
        "memorySize": 2523136,
        "committedMemory": 2523136,
        "capacity": 2161760,
        "used": 2161760,
        "available": 0
      },
      "map_space": {
        "memorySize": 1052672,
        "committedMemory": 1052672,
        "capacity": 688880,
        "used": 688880,
        "available": 0
      },
      "large_object_space": {
        "memorySize": 34304000,
        "committedMemory": 34304000,
        "capacity": 34249008,
        "used": 34249008,
        "available": 0
      },
      "code_large_object_space": {
        "memorySize": 49152,
        "committedMemory": 49152,
        "capacity": 3552,
        "used": 3552,
        "available": 0
      },
      "new_large_object_space": {
        "memorySize": 0,
        "committedMemory": 0,
        "capacity": 2094976,
        "used": 0,
        "available": 2094976
      }
    }
  },
  "resourceUsage": {
    "userCpuSeconds": 1843.52,
    "kernelCpuSeconds": 15.453,
    "cpuConsumptionPercent": 115.751,
    "maxRss": 2247430144,
    "pageFaults": {
      "IORequired": 1055075,
      "IONotRequired": 0
    },
    "fsActivity": {
      "reads": 3315,
      "writes": 6
    }
  },
  "libuv": [
  ],
  "environmentVariables": {
    "ADVOCA_URL": "https://test.advoca.localhost",
    "ALLUSERSPROFILE": "C:\\ProgramData",
    "APPDATA": "C:\\Users\\User\\AppData\\Roaming",
    "BABEL_ENV": "production",
    "BROWSER": "none",
    "CHECK_SYNTACTIC_ERRORS": "true",
    "CommonProgramFiles": "C:\\Program Files\\Common Files",
    "CommonProgramFiles(x86)": "C:\\Program Files (x86)\\Common Files",
    "CommonProgramW6432": "C:\\Program Files\\Common Files",
    "COMPILER_OPTIONS": "{}",
    "COMPOSE_CONVERT_WINDOWS_PATHS": "true",
    "COMPUTERNAME": "IGORPC",
    "ComSpec": "C:\\WINDOWS\\system32\\cmd.exe",
    "configsetroot": "C:\\WINDOWS\\ConfigSetRoot",
    "CONTEXT": "C:\\Sites\\adopus-portal",
    "DriverData": "C:\\Windows\\System32\\Drivers\\DriverData",
    "ESLINT": "false",
    "ESLINT_OPTIONS": "{}",
    "GIT_SSH": "C:\\Program Files\\PuTTY\\plink.exe",
    "GOPATH": "C:\\Users\\User\\go",
    "HOMEDRIVE": "C:",
    "HOMEPATH": "\\Users\\User",
    "INIT_CWD": "C:\\Sites\\adopus-portal",
    "JAVA_HOME": "C:\\Program Files (x86)\\Java\\jdk1.8.0_172",
    "LOCALAPPDATA": "C:\\Users\\User\\AppData\\Local",
    "LOGONSERVER": "\\\\IGORPC",
    "MEMORY_LIMIT": "2048",
    "Nmap": "C:\\Program Files (x86)\\Nmap",
    "NODE": "C:\\Program Files\\nodejs\\node.exe",
    "NODE_ENV": "production",
    "NODE_PATH": "",
    "npm_config_argv": "{\"remain\":[],\"cooked\":[\"run\",\"build\"],\"original\":[\"build\"]}",
    "npm_config_bin_links": "true",
    "npm_config_ignore_optional": "",
    "npm_config_ignore_scripts": "",
    "npm_config_init_license": "MIT",
    "npm_config_init_version": "1.0.0",
    "npm_config_registry": "https://registry.yarnpkg.com",
    "npm_config_save_prefix": "^",
    "npm_config_strict_ssl": "true",
    "npm_config_user_agent": "yarn/1.21.1 npm/? node/v12.13.1 win32 x64",
    "npm_config_version_commit_hooks": "true",
    "npm_config_version_git_message": "v%s",
    "npm_config_version_git_sign": "",
    "npm_config_version_git_tag": "true",
    "npm_config_version_tag_prefix": "v",
    "npm_execpath": "C:\\Program Files (x86)\\Yarn\\bin\\yarn.js",
    "npm_lifecycle_event": "build",
    "npm_lifecycle_script": "react-scripts build",
    "npm_node_execpath": "C:\\Program Files\\nodejs\\node.exe",
    "npm_package_browserslist_development_0": "last 1 chrome version",
    "npm_package_browserslist_development_1": "last 1 firefox version",
    "npm_package_browserslist_development_2": "last 1 safari version",
    "npm_package_browserslist_production_0": ">0.2%",
    "npm_package_browserslist_production_1": "not dead",
    "npm_package_browserslist_production_2": "not op_mini all",
    "npm_package_dependencies_all": "^0.0.0",
    "npm_package_dependencies_antd": "^3.26.6",
    "npm_package_dependencies_apollo_boost": "^0.4.7",
    "npm_package_dependencies_apollo_cache": "^1.3.4",
    "npm_package_dependencies_apollo_client": "^2.6.8",
    "npm_package_dependencies_apollo_link": "^1.2.13",
    "npm_package_dependencies_apollo_utilities": "^1.3.3",
    "npm_package_dependencies_axios": "^0.19.1",
    "npm_package_dependencies_graphql": "^14.5.8",
    "npm_package_dependencies_immer": "^5.3.2",
    "npm_package_dependencies_js_sha256": "^0.9.0",
    "npm_package_dependencies_lodash": "^4.17.15",
    "npm_package_dependencies_mobx": "^5.15.2",
    "npm_package_dependencies_mobx_react_lite": "^1.5.2",
    "npm_package_dependencies_mobx_state_tree": "^3.15.0",
    "npm_package_dependencies_moment": "^2.24.0",
    "npm_package_dependencies_rc_datepicker": "^5.0.15",
    "npm_package_dependencies_react": "^16.12.0",
    "npm_package_dependencies_react_apollo": "^3.1.3",
    "npm_package_dependencies_react_bootstrap": "^1.0.0-beta.16",
    "npm_package_dependencies_react_dom": "^16.12.0",
    "npm_package_dependencies_react_outside_click_handler": "^1.3.0",
    "npm_package_dependencies_react_reveal": "^1.2.2",
    "npm_package_dependencies_react_router_dom": "^5.1.2",
    "npm_package_dependencies_react_scripts": "3.3.0",
    "npm_package_dependencies_react_select": "^3.0.8",
    "npm_package_dependencies_regexpp": "^3.0.0",
    "npm_package_dependencies_sweetalert2": "^9.5.4",
    "npm_package_dependencies_typescript": "~3.7.2",
    "npm_package_dependencies_use_immer": "^0.3.5",
    "npm_package_dependencies_uuid": "^3.3.3",
    "npm_package_dependencies__material_ui_core": "^4.8.3",
    "npm_package_dependencies__material_ui_icons": "^4.5.1",
    "npm_package_dependencies__testing_library_jest_dom": "^4.2.4",
    "npm_package_dependencies__testing_library_react": "^9.3.2",
    "npm_package_dependencies__testing_library_user_event": "^8.0.3",
    "npm_package_dependencies__trendmicro_react_sidenav": "^0.5.0",
    "npm_package_dependencies__types_jest": "^24.0.0",
    "npm_package_dependencies__types_node": "^13.1.6",
    "npm_package_dependencies__types_react": "^16.9.0",
    "npm_package_dependencies__types_react_dom": "^16.9.0",
    "npm_package_dependencies__types_react_router_dom": "^5.1.3",
    "npm_package_dependencies__types_uuid": "^3.4.7",
    "npm_package_devDependencies_tslint": "^5.20.1",
    "npm_package_devDependencies_tslint_config_prettier": "^1.18.0",
    "npm_package_devDependencies_tslint_react": "^4.1.0",
    "npm_package_eslintConfig_extends": "react-app",
    "npm_package_name": "adopus-portal-typescript",
    "npm_package_private": "true",
    "npm_package_readmeFilename": "readme.docker.txt",
    "npm_package_scripts_build": "react-scripts build",
    "npm_package_scripts_eject": "react-scripts eject",
    "npm_package_scripts_start": "react-scripts start",
    "npm_package_scripts_test": "react-scripts test",
    "npm_package_version": "0.1.0",
    "NUMBER_OF_PROCESSORS": "8",
    "NVM_HOME": "C:\\Users\\User\\AppData\\Roaming\\nvm",
    "NVM_SYMLINK": "C:\\Program Files\\nodejs",
    "OneDrive": "C:\\Users\\User\\OneDrive",
    "OS": "Windows_NT",
    "Path": "C:\\Users\\User\\AppData\\Local\\Temp\\yarn--1580578676150-0.03995858093112847;C:\\Sites\\adopus-portal\\node_modules\\.bin;C:\\Users\\User\\AppData\\Local\\Yarn\\Data\\link\\node_modules\\.bin;C:\\Program Files\\libexec\\lib\\node_modules\\npm\\bin\\node-gyp-bin;C:\\Program Files\\lib\\node_modules\\npm\\bin\\node-gyp-bin;C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\node-gyp-bin;C:\\Program Files\\Docker\\Docker\\Resources\\bin;C:\\wamp\\bin\\php\\php7.2.4;C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;C:\\Program Files\\dotnet\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Program Files\\PuTTY\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\ProgramData\\ComposerSetup\\bin;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Program Files (x86)\\CrSSL\\bin;C:\\Users\\User\\AppData\\Roaming\\nvm;C:\\Program Files\\nodejs;C:\\Program Files\\TortoiseGit\\bin;C:\\HashiCorp\\Vagrant\\bin;C:\\Go\\bin;C:\\Program Files (x86)\\Yarn\\bin\\;C:\\Program Files\\Git\\cmd;C:\\RailsInstaller\\Git\\cmd;C:\\RailsInstaller\\Ruby2.3.3\\bin;C:\\cross_platform\\flutter_windows_v0.5.1-beta\\flutter\\bin;C:\\Users\\User\\AppData\\Local\\atom\\bin;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Users\\User\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\User\\AppData\\Roaming\\Composer\\vendor\\bin;C:\\Users\\User\\AppData\\Roaming\\npm;C:\\Users\\User\\AppData\\Roaming\\nvm;C:\\Program Files\\nodejs;C:\\Users\\User\\.dotnet\\tools;C:\\Users\\igor\\AppData\\Roaming\\npm;C:\\Users\\User\\go\\bin;C:\\Users\\User\\AppData\\Local\\Yarn\\bin",
    "PATHEXT": ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JSE;.WSF;.WSH;.MSC",
    "PROCESSOR_ARCHITECTURE": "AMD64",
    "PROCESSOR_IDENTIFIER": "Intel64 Family 6 Model 71 Stepping 1, GenuineIntel",
    "PROCESSOR_LEVEL": "6",
    "PROCESSOR_REVISION": "4701",
    "ProgramData": "C:\\ProgramData",
    "ProgramFiles": "C:\\Program Files",
    "ProgramFiles(x86)": "C:\\Program Files (x86)",
    "ProgramW6432": "C:\\Program Files",
    "PROMPT": "$P$G",
    "PSModulePath": "C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules\\",
    "PUBLIC": "C:\\Users\\Public",
    "REACT_APP_CHAT_URL": "http://192.168.250.224:80/api/helse",
    "REACT_APP_GRAPHQL_URL": "http://localhost:5000",
    "REACT_APP_PROXY_URL": "https://proxy.test.advoca.localhost:4430",
    "SESSIONNAME": "Console",
    "SystemDrive": "C:",
    "SystemRoot": "C:\\WINDOWS",
    "TEMP": "C:\\Users\\User\\AppData\\Local\\Temp",
    "TMP": "C:\\Users\\User\\AppData\\Local\\Temp",
    "TSCONFIG": "C:\\Sites\\adopus-portal\\tsconfig.json",
    "TSLINT": "",
    "TSLINTAUTOFIX": "false",
    "TYPESCRIPT_PATH": "C:\\Sites\\adopus-portal\\node_modules\\typescript\\lib\\typescript.js",
    "USERDOMAIN": "IGORPC",
    "USERDOMAIN_ROAMINGPROFILE": "IGORPC",
    "USERNAME": "User",
    "USERPROFILE": "C:\\Users\\User",
    "USE_INCREMENTAL_API": "true",
    "VBOX_MSI_INSTALL_PATH": "C:\\Program Files\\Oracle\\VirtualBox\\",
    "VUE": "{\"compiler\":\"vue-template-compiler\",\"enabled\":false}",
    "WATCH": "",
    "windir": "C:\\WINDOWS",
    "WORK_DIVISION": "1",
    "YARN_WRAP_OUTPUT": "false"
  },
  "sharedObjects": [
    "C:\\Program Files\\nodejs\\node.exe",
    "C:\\WINDOWS\\SYSTEM32\\ntdll.dll",
    "C:\\WINDOWS\\System32\\KERNEL32.DLL",
    "C:\\WINDOWS\\System32\\KERNELBASE.dll",
    "C:\\WINDOWS\\System32\\WS2_32.dll",
    "C:\\WINDOWS\\System32\\RPCRT4.dll",
    "C:\\WINDOWS\\SYSTEM32\\dbghelp.dll",
    "C:\\WINDOWS\\System32\\ADVAPI32.dll",
    "C:\\WINDOWS\\System32\\ucrtbase.dll",
    "C:\\WINDOWS\\System32\\msvcrt.dll",
    "C:\\WINDOWS\\System32\\sechost.dll",
    "C:\\WINDOWS\\System32\\USER32.dll",
    "C:\\WINDOWS\\System32\\win32u.dll",
    "C:\\WINDOWS\\System32\\GDI32.dll",
    "C:\\WINDOWS\\System32\\gdi32full.dll",
    "C:\\WINDOWS\\System32\\msvcp_win.dll",
    "C:\\WINDOWS\\System32\\PSAPI.DLL",
    "C:\\WINDOWS\\System32\\CRYPT32.dll",
    "C:\\WINDOWS\\System32\\MSASN1.dll",
    "C:\\WINDOWS\\SYSTEM32\\IPHLPAPI.DLL",
    "C:\\WINDOWS\\SYSTEM32\\USERENV.dll",
    "C:\\WINDOWS\\System32\\profapi.dll",
    "C:\\WINDOWS\\SYSTEM32\\bcrypt.dll",
    "C:\\WINDOWS\\SYSTEM32\\WINMM.dll",
    "C:\\WINDOWS\\SYSTEM32\\winmmbase.dll",
    "C:\\WINDOWS\\System32\\cfgmgr32.dll",
    "C:\\WINDOWS\\System32\\IMM32.DLL",
    "C:\\WINDOWS\\System32\\powrprof.dll",
    "C:\\WINDOWS\\SYSTEM32\\CRYPTBASE.DLL",
    "C:\\WINDOWS\\System32\\bcryptPrimitives.dll",
    "C:\\WINDOWS\\system32\\uxtheme.dll",
    "C:\\WINDOWS\\System32\\combase.dll",
    "C:\\WINDOWS\\system32\\mswsock.dll",
    "C:\\WINDOWS\\System32\\kernel.appcore.dll",
    "C:\\WINDOWS\\System32\\NSI.dll",
    "C:\\WINDOWS\\SYSTEM32\\dhcpcsvc6.DLL",
    "C:\\WINDOWS\\SYSTEM32\\dhcpcsvc.DLL",
    "C:\\WINDOWS\\system32\\napinsp.dll",
    "C:\\WINDOWS\\system32\\pnrpnsp.dll",
    "C:\\WINDOWS\\system32\\NLAapi.dll",
    "C:\\WINDOWS\\SYSTEM32\\DNSAPI.dll",
    "C:\\WINDOWS\\System32\\winrnr.dll",
    "C:\\WINDOWS\\System32\\wshbth.dll"
  ]
}

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 17
  • Comments: 42

Commits related to this issue

Most upvoted comments

Someone ordered some recent activity.

I also got the error with new project npx create-react-app and installing plotly

adding the memory flag to start scripts fixing the issue

"start": "react-scripts --max_old_space_size=4096 start",

my package.json

{
  "name": "plot.ly",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.3.2",
    "@testing-library/user-event": "^7.1.2",
    "plotly.js": "^1.52.3",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-plotly.js": "^2.4.0",
    "react-scripts": "3.4.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

Please, keep this alive. HOPEFULLY, somebody can fix it.

Indeed

Sneakily marking this as stale over Christmas break will fly as much as the turkey I have spent the past 3 days eating.

I’ve bumped into the same issue today, when upgrading my npm packages to newer versions (including react-scripts and typescript). Increasing max space size even more to --max_old_space_size=8192 solved the issue for me. 4096 wasn’t enough. I’ve also realized that I need to buy more RAM…

I tested with Node 12 and 10, and I’m having the same issue. Also, I can’t build my app using npm run build, it never ends.

Update 1

I ran DEBUG='*,-babel' npm run build and the process get stuck with this last message:

eslint:cli-engine Linting complete in: 3193ms +12ms

Update 2

I tried to increase the memory with: NODE_OPTIONS=--max_old_space_size=4096 DISABLE_ESLINT_PLUGIN=true DEBUG='*,-babel' npm run build with no luck.

Solution (plot twist)

I created an experimental type that recursively references itself… it looks as follow:

export type Paths<
  T,
  P extends string | undefined = undefined,
  N = NonTraversable,
  F = InvalidIndexValue
> = keyof {
  [key in keyof T as T[key] extends N
    ? T[key] extends F
      ? never
      : Prefix<key, P>
    : T[key] extends any[]
    ? ArrayElement<T[key]> extends N
      ? Prefix<key, P>
      : Paths<ArrayElement<T[key]>, Prefix<key, P>, N, F>
    : Paths<T[key], Prefix<key, P>, N, F>]: never
}

Removing that type fixed my build. Also, my machine doesn’t sound like an helicopter during development.

Double down on that issue.

I am experiencing this issue also and it seems to strike randomly, but then mercilessly and endlessly once triggered.

I have experienced on several machines (MacOS and Windows), with several node versions, in several terminals… i.e. it is something within my current React build. Unfortunately the build is somewhat out of date and updating portions is a much larger job than what can be currently committed to.

Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Machine experiences an ever increasing memory usage shortly before cutting out when it kills this process during the build.

❌ Sourcemap Fix

GENERATE_SOURCEMAP=false

This does absolutely nothing for my build unfortunately.

❌ Increasing Memory Allocation

react-scripts --max_old_space_size=4096 start

Specifying the memory allowance here also does nothing for this.

Information

React scripts version: ^1.1.5 (as noted updating is simply not going to be possible right now)

I’m really getting nowhere with this currently if anyone has any other ideas.

@Relaxe111, I am having the same problem since 3.3.0. Version 3.2.0 works ok. I can’t believe they just ignore all the bug reports on this issue for the last 3 months. So the tickets will be automatically closed by bots. Version 3.2.0 build is very slow. But 3.3.x and above stopped working. We are looking at alternatives.

Reporting that craco --max_old_space_size=4096 build worked for me, although I am using craco and build.

I was able to start the development server locally just fine (outside of our docker-container npm run start) but inside the docker-container, we continue to run into start heap issues which causes our docker-container node process to be killed.

I just encountered this same problem after adding source maps to a library that I’m developing & importing into my create-react-app.

I added GENERATE_SOURCEMAP=false to the .env in my create-react-app and that resolved the issue… Which is too bad because I’d prefer to have source maps. But I’d also prefer my project to build so I guess I’ll have to do without source maps until we find a better solution.

I have this issue too. I have it on yarn start in project with TypeScript.

Increasing memory for Node didn’t help me.

"react-scripts": "3.4.1"