create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

Since updating to 3.3.0, running out of memory

Open daviseford opened this issue 6 years ago • 136 comments

Describe the bug

After upgrading to 3.3.0 and TS 3.7.3 (was previously on 3.2.0 and TS 3.7.2), I am unable to run yarn start

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

Reverting to react-scripts v3.2.0 resolves this issue - Typescript being at 3.7.3 or 3.7.2. has no effect, so I've narrowed it to react-scripts.

Did you try recovering your dependencies?

Yes, blew away node_modules and re-ran yarn, tried without a lock file, etc. No dice.

Environment

Windows 10, VSCode (also occurs on my macbook)

daviseford avatar Dec 05 '19 21:12 daviseford

You’ll need a reproducible repo for this. There are some dependencies upgrade in 3.3.0 and that could have taken more memory usage.

endiliey avatar Dec 06 '19 02:12 endiliey

I also encountered the same problem in the company project.

xiaoxiangmoe avatar Dec 06 '19 10:12 xiaoxiangmoe

me too

anhquande avatar Dec 06 '19 10:12 anhquande

I apologize because this isn't a minimally reproducible repo, but this is my repo having problems: https://github.com/daviseford/aos-reminders

Just running yarn, upgrading react-scripts to 3.3.0, and running yarn start will give you the bad behavior.

I will look into creating a minimal version after work.

daviseford avatar Dec 06 '19 13:12 daviseford

Have you tried removing the existing node_modules, then reinstalling? Maybe also removing the lockfile? Just out of interest.

mrmckeb avatar Dec 06 '19 14:12 mrmckeb

Yes to both.

daviseford avatar Dec 06 '19 14:12 daviseford

I had the same error with nodejs v10; upgrading to nodejs v12 fixed the issue for me.

MasterCassim avatar Dec 08 '19 13:12 MasterCassim

I am on v12.11.0

daviseford avatar Dec 08 '19 15:12 daviseford

I am on v13.2.0

xiaoxiangmoe avatar Dec 09 '19 02:12 xiaoxiangmoe

Temporary workaround is to set a larger max-old-space-size eg, react-scripts --expose-gc --max-old-space-size=8192 ... as stated in https://github.com/facebook/create-react-app/issues/8130#issue-535323604

petetnt avatar Dec 09 '19 21:12 petetnt

Use @petetnt suggestion is work but it take a lot of build time.

abrcdf1023 avatar Dec 10 '19 07:12 abrcdf1023

I experienced this today, however it was from updating from 3.0.1 to 3.2.0. After reverting to 3.0.1 the problem disappeared.

I'll attach the generated report.json file. report.20191213.130235.34745.0.001.json.zip

MichaelCharles avatar Dec 13 '19 04:12 MichaelCharles

Same problem here. I upgraded to react-scripts 3.3.0 and webpack 4.41.2 and I had this memory problem.

@petetnt suggestion did not help

Disabling sourcemaps generation solved the problem, but you need them when developing !

chawax avatar Dec 18 '19 11:12 chawax

Please see https://github.com/wojtekmaj/react-pdf/issues/498#issuecomment-566948710 - a response to what I think may be the same issue. I am not sure how one fixes this within the context of create-react-app.

robsco-git avatar Dec 19 '19 08:12 robsco-git

It looks like this issue: babel/babel#10875. That's fixed in https://github.com/babel/babel/releases/tag/v7.7.7. create-react-app should bump the @babel/core dependency.

astrada avatar Dec 19 '19 17:12 astrada

Having this same issue since I upgraded react-scripts. Node version v13.1.0. react-scripts 3.3.0.

yusufnb avatar Dec 24 '19 18:12 yusufnb

The following in package.json fixed the issue for me (react-scripts 3.3.0, react-pdf) without requiring the memory increase flags:

  "devDependencies": {
    "@babel/core": "^7.7.7",

gnmerritt avatar Jan 07 '20 18:01 gnmerritt

@gnmerritt this didn't work for us, anything else you changed?

benbruscella avatar Jan 08 '20 03:01 benbruscella

I've been able to run app changing npm start script

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

erik-sytnyk avatar Jan 09 '20 09:01 erik-sytnyk

The following in package.json fixed the issue for me (react-scripts 3.3.0, react-pdf) without requiring the memory increase flags:

  "devDependencies": {
    "@babel/core": "^7.7.7",

Adding "@babel/core": "^7.7.7", to devDependencies did work in my project, even though I didn't have explicit dependency to @bable/core previously in package.json.

There were (and still are) multiple dependencies to @bable/core in package-lock.json, of course. Intrestingly, those "dependencies of dependencies" still refer to 7.7.4 in package-lock.json. But the project starts and builds fine.

jacobwod avatar Jan 09 '20 10:01 jacobwod