Since updating to 3.3.0, running out of memory
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)
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.
I also encountered the same problem in the company project.
me too
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.
Have you tried removing the existing node_modules, then reinstalling? Maybe also removing the lockfile? Just out of interest.
Yes to both.
I had the same error with nodejs v10; upgrading to nodejs v12 fixed the issue for me.
I am on v12.11.0
I am on v13.2.0
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
Use @petetnt suggestion is work but it take a lot of build time.
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
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 !
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.
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.
Having this same issue since I upgraded react-scripts. Node version v13.1.0. react-scripts 3.3.0.
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 this didn't work for us, anything else you changed?
I've been able to run app changing npm start script
"start": "react-scripts --max_old_space_size=4096 start",
The following in
package.jsonfixed 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.