wmonk / create-react-app-typescript

DEPRECATED: Create React apps using typescript with no build configuration.
3.7k stars 492 forks source link

ForkTsCheckerWebpackPlugin out of memory #369

Open stephenkoo opened 6 years ago

stephenkoo commented 6 years ago

Is this a bug report?

Yes.

Can you also reproduce the problem with npm 4.x?

Yes.

Which terms did you search for in User Guide?

ForkTsCheckerWebpackPlugin, out of memory, fork-ts-checker-webpack-plugin, memoryLimit.

Environment

  1. Operating system: macOS High Sierra v1013.6
  2. Browser and version:
    • Node 10.7.0
    • npm 4 as instructed (but use yarn v1.7.0 usually),

Steps to Reproduce

  1. Open project
  2. npm install
  3. npm start

Expected Behavior

To run the app, displaying a <button> element with the text Yo.

Actual Behavior

Produces error:

ts-loader: Using typescript@2.9.2 and /Users/stephenkoo/code/src/gitlab.com/stephenkoo/kanso/tsconfig.json

<--- Last few GCs --->

[4141:0x104002400]    36973 ms: Scavenge 2033.4 (2079.8) -> 2033.1 (2080.3) MB, 2.9 / 0.0 ms  (average mu = 0.112, current mu = 0.046) allocation failure
[4141:0x104002400]    36978 ms: Scavenge 2033.8 (2080.3) -> 2033.4 (2081.3) MB, 2.8 / 0.0 ms  (average mu = 0.112, current mu = 0.046) allocation failure
[4141:0x104002400]    36985 ms: Scavenge 2034.1 (2081.3) -> 2033.7 (2081.8) MB, 3.4 / 0.0 ms  (average mu = 0.112, current mu = 0.046) allocation failure

<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0x134e18a841bd]
    1: StubFrame [pc: 0x134e18aa470f]
Security context: 0x1428929e6c9 <JSObject>
    2: slice [0x14289286979](this=0x142733482b9 <JSArray[6]>,0)
    3: /* anonymous */(aka /* anonymous */) [0x14273348371] [/Users/stephenkoo/code/src/gitlab.com/stephenkoo/kanso/node_modules/typescript/lib/typescript.js:~34457] [pc=0x134e18fdf769](this=0x142995822e1 <undefined>,t=0x1426fe04419 <TypeObject map = 0x14259d...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x100037ddb node::Abort() [/usr/local/Cellar/node/10.7.0/bin/node]
 2: 0x100037f65 node::OnFatalError(char const*, char const*) [/usr/local/Cellar/node/10.7.0/bin/node]
 3: 0x10018274b v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/Cellar/node/10.7.0/bin/node]
 4: 0x1001826ed v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/Cellar/node/10.7.0/bin/node]
 5: 0x10045b3fe v8::internal::Heap::UpdateSurvivalStatistics(int) [/usr/local/Cellar/node/10.7.0/bin/node]
 6: 0x10045d0a1 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/usr/local/Cellar/node/10.7.0/bin/node]
 7: 0x10045a763 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/Cellar/node/10.7.0/bin/node]
 8: 0x1004596b4 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/Cellar/node/10.7.0/bin/node]
 9: 0x1004618b3 v8::internal::Heap::AllocateRawWithRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/Cellar/node/10.7.0/bin/node]
10: 0x10043f4bc v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/usr/local/Cellar/node/10.7.0/bin/node]
11: 0x100639d91 v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/Cellar/node/10.7.0/bin/node]
12: 0x134e18a841bd
Type checking and linting aborted - probably out of memory. Check `memoryLimit` option in ForkTsCheckerWebpackPlugin configuration.
screen shot 2018-07-19 at 7 23 47 pm screen shot 2018-07-19 at 7 23 57 pm

Reproducible Demo

https://github.com/wmonk/create-react-app-typescript/files/2209236/kanso.zip

malafreniere commented 6 years ago

Getting the same error, would be nice to be able to override the memoryLimit option of ForkTsCheckerWebpackPlugin in https://github.com/wmonk/create-react-app-typescript/blob/master/packages/react-scripts/config/webpack.config.dev.js

new ForkTsCheckerWebpackPlugin({
      async: false,
      watch: paths.appSrc,
      tsconfig: paths.appTsConfig,
      tslint: paths.appTsLint,
      --> memoryLimit: env.tsCheckerMemoryLimit <-- ???
    }),
adamhp commented 6 years ago

I'm receiving this error also, apparently after upgrading my node version to 10.7.0, from what I can tell, but may be unrelated.

DorianGrey commented 6 years ago

Given the instructions above, you were using node 10.x. Is this error reproducible with 8.11 (the current LTS) as well?

sbusch commented 6 years ago

node 8.11.3, same error

leobrdar commented 5 years ago

Hi all,

any updates on this? Did any of you find a workaround?

I'm getting a similar issue:

Starting the development server...

ts-loader: Using typescript@2.9.2 and /Users/leo/my-app/tsconfig.json
/Users/leo/my-app/node_modules/fork-ts-checker-webpack-plugin/lib/service.js:22
        throw error;
        ^

RangeError: Maximum call stack size exceeded
    at Object.flatMap (/Users/leo/my-app/node_modules/tslint/lib/utils.js:151:18)
    at Linter.getAllFailures (/Users/leo/my-app/node_modules/tslint/lib/linter.js:139:32)
    at Linter.lint (/Users/leo/my-app/node_modules/tslint/lib/linter.js:99:33)
    at /Users/leo/my-app/node_modules/fork-ts-checker-webpack-plugin/lib/IncrementalChecker.js:142:30
    at WorkSet.forEach (/Users/leo/my-app/node_modules/fork-ts-checker-webpack-plugin/lib/WorkSet.js:17:13)
    at IncrementalChecker.getLints (/Users/leo/my-app/node_modules/fork-ts-checker-webpack-plugin/lib/IncrementalChecker.js:139:17)
    at run (/Users/leo/my-app/node_modules/fork-ts-checker-webpack-plugin/lib/service.js:15:29)
    at process.<anonymous> (/Users/leo/my-app/node_modules/fork-ts-checker-webpack-plugin/lib/service.js:38:5)
    at emitTwo (events.js:126:13)
    at process.emit (events.js:214:7)

Could this be the same issue or is this something different?

Environment:

kelly-tock commented 5 years ago

is setting memoryLimit option not working for you?