-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Call and entry last allocation Failed - JS heap out of memory #2555
Comments
have you tried adding/increasing swap space? https://github.com/facebookincubator/create-react-app/blob/67f6163b0d86a2980fbaba5ec931fa27abad2f99/packages/react-scripts/template/README.md#npm-run-build-silently-fails
|
So this error pops up when I'm building locally and if I'm not mistaken, the macOS already allocates it automatically (https://apple.stackexchange.com/questions/190892/why-is-my-macbook-pro-already-using-swap-memory). Is there anything else I could try to get it to build? |
Try downgrading npm to 4 or 3, delete node_modules and rerun npm install. |
Hum, I got the exact same error again with both npm 3 and 4.
Does react-scripts adjust the |
It would help if you provided a project reproing this. I guess it's probably not likely you can, but still. |
I'm seeing the same thing since I updated to the latest Sorry I can't provide more details, but just wanted to indicate that this isn't a one off machine issue.
EnvironmentRun these commands in the project folder and fill in their results: npm ls react-scripts (if you haven’t ejected): [email protected] Then, specify: Operating system: Ubuntu 16.04 |
A project reproducing this would still be helpful. Maybe Webpack is hitting some edge condition or there's a particular pattern that causes over allocation. |
Understand, I just can't reproduce with any regularity. Thought it was a function of number of rebuilds, but can't get it to reproduce at all with a reduced project even after 1000s of rebuilds. Anything I can enable locally to help debug when I do hit it? |
Maybe @sokra or @TheLarkInn have ideas on debugging ooms. |
Okay, created a project that can reproduce the error with regularity. Issue is that it's got some company-specific things in there, so I've made it private. Happy to add anyone as a collaborator. Added @gaearon and @viankakrisna |
@gaearon @viankakrisna I'm also struck with this issue. I have a 4.4MB index.ios.js file (transpiled from ClojureScript to JS). Can you remove the low-priory-need-more-information label now that @kadhirvelm submitted a project for repro ? |
I'm digging on this issue and can replicate the problem on the private repo with this environment:
Disabling UglifyJS plugin in It surely helps if anybody having this issue can make a public repo with a reduced example. It's not specific to |
Possibly related: It seems that this issue is affecting builds with a large size of source files. Possible workaround:
|
Btw, can you all replicate this problem with react-scripts |
Same error on the private repo using |
@gaearon what we can do here is to fail gracefully, but I do not know how to fail gracefully from a crash like this. Maybe we can run webpack in a separate process and parse the error message? |
Do I understand correctly that everyone who experienced this issue so far had large source files? |
I have lots of source files, totaling 1.33MB minified. Single largest source file is 105 kB. |
Public repo for reproducing case: |
Is it in the |
Currently yes, it's in the |
To add another voice, all ClojureScript developers are affected by this, as the ClojureScript compiler (along with Google Closure) produces a single large bundle (could be 4 MB or larger) that needs to be further processed by the RN packager |
Disabling UglifyJS' Can you all dive to
The only thing that is different from latest CRA version is |
Would it be acceptable to you to pull this file out of |
I’m not fully following. Is this related to Create React App? Your concern sounds specific to React Native. Would the workaround I described in last comment ( |
Sorry, I misread the issue and thought it was about the RN packager itself. Please ignore my comment. To the best of my knowledge, create-react-app isn't used with ClojureScript very often yet. |
Yes, if that's what is causing the issue. I can pull out the bulk of the file and put it in the |
Cool, so based on the responses here, I managed to solve the issue on my end. Yeah as everyone said, it was due to the size of the project, not due to resin-sdk. It just happened to be the last package that really put us over the top. The error message that popped up when the project was over the size recommendation, but under the size necessary to crash helped tremendously in solving the issue:
For anyone else still trying to fix this issue, we used the Reduce Dependencies as a guide for what the largest files were and then used Code Splitting to isolate said files. This helped us create multiple smaller files, which ultimately led to a successful build. Is it at all possible when the build fails due to the memory issue, to display the above error message instead? That would've been really helpful in fixing the problem |
Maybe instead of spawning we can do forking here so we can detect any error message early without parent killed when the child crash But I don't know how to parse stdout programmatically using a fork... Googling only shows how to do ipc messaging / regular spawn. |
You can now disable sourcemaps via setting I'll close this as the solution for now will be to disable source maps or implement code splitting via |
I have a large file of size 31MB in the app. on |
|
@yjb94
|
Thanks sourcemap: false in webpack.config.prod.js |
worked for me too |
Description
Recently we included the resin-sdk within our React app, which is causing the
npm run build
command to emit this error:When we removed the resin-sdk from the code, it built just fine, which made me look into increasing the memory allocation. After doing quite a bit of research, I tried increasing the old space size with:
node --max_old_space_size=4096 node_modules/.bin/react_scripts build
, but based on the output, it seems like the allocated space has not increased.Expected behavior
Perhaps I'm misunderstanding, or not executing this correctly, but I'd expect that when arguments are passed into the react-script, it takes them into account when executing the build.
Actual behavior
Whether I input extra parameters or not, I end up with the same output error when building production code.
Environment
Run these commands in the project folder and fill in their results:
npm ls react-scripts
(if you haven’t ejected): [email protected]node -v
: v6.9.4npm -v
: 5.0.3Then, specify:
The text was updated successfully, but these errors were encountered: