-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
yarn serve - JavaScript heap out of memory crash #1453
Comments
change the scripts at package.json as below |
this is not an issue from vue-cli ,this is the limit from nodejs. |
There's nothing vue-cli can do about this. |
Just in case anyone else finds this issue I had to change the package.json serve script to the following: "serve" : "node --max_old_space_size=4096 node_modules/.bin/vue-cli-service serve --open" @ryouaki your path didn't work for me |
@atinybeardedman this worked for me but just wanna say, that my own webpack config doesn't have this issue with memory |
@xrei this is because of your code. for me , in my project , i have more than 500 pages and more 100 base components , and with a large assets and css with cssmodule. |
@atinybeardedman you should change the path to you own path which you saved the vue-cli scripts. |
@yyx990803 You can fix this by adding I only had a small project that I developed for 3 hours, and this happened for at least 5 times. I feel a lot of people might run into this issue. Root cause is here: webpack/webpack#1914 (comment). From what I read in the thread, it seems to be that the memory usage from sourcemap generation & file watching hits V8's limit (1400MB). Bumping the limit to 4GB should make the ceiling much harder to hit. |
@octref we can do that for now. Although in the long run we probably want to see if there's anything we can do to reduce the heap usage. I think it's because a single Vue file actually involves multiple source maps being passed and merged. |
Adding a directory of large library files to my project's |
I get this crash after about 10 saves and webpack tries to compile. |
I'm also having this problem a few times / day after a few dozen of saves even when increasing the max_old_space_size=4096. I never had this problem using the old vue cli 2.9.x + webpack template and the default max_old_space_size. perhaps an upstream bug somewhere that is increasing the heap ? |
I'm still getting this crash as well - have tried the |
Might be related to: webpack/webpack#6929 |
i'm currently used version is 3.0.0-beta.15(often crashed because of memory leaks), what can I do to upgrade to the new version(v3.0.0-rc.3)? |
@vanderlin try updating your dev-dependencies:
make sure u get I have been seeing a lot less memory usage (no crashes yet) but I'll have to test it out more to tell if it is completely fixed. |
@DRoet I have been testing webpack 4.15.1 + and postcss-loader 2.1.6+ too, and it seems the memory leak issue is much better. Do you want to send a PR? I'm in China now and for some reason cannot download certain dependencies in vue-cli (chromedriver) and yarn would fail to update the lock file. You can just update webpack / postcss-loader at |
@octref I checked and the current |
Oh...Seems @Akryum unintentionally fixed 3 memory leaks 93940c2#diff-90339eb44e295051bd16d3e099b219d8 😛 |
That was intentional, I've been monitoring the issue on webpack repo 😸 |
edit package.json "serve":"node --max_old_space_size=4096 node_modules/@vue/cli-service/bin/vue-cli-service.js serve --open" |
For what it's worth, I haven't had this issue in a very long time, and I didn't change anything about my setup. |
That's right. in the latest vue-cli this isn't happening anymore. |
as suggested here vuejs/vue-cli#1453
So I see that this issue is closed but none of the fixes noted here in changing the package.json seem to fix the issue. I was using the Vue UI and am no longer able to and am starting to no longer be able to make more than 2 or 3 changes before it runs out of memory. I am trying increase the memory for the following script
|
solution:
|
thinks,it really helps me. |
If your application crash while building scss files try installing those dependencies node-sass, style-loader and sass-loader, this worked for me! |
for me worked even just |
add .eslintignore to your project directory will do a workaround sample .eslintignore file node_modules |
There is definitely a (large) memory leak causing yarn serve / npm serve to crash consistently and reproducibly. Yes, I can delay that crash somewhat by increasing memory for Node until my dev machine has swapped everything else out of RAM. Not sure why this issue is closed? This memory leak is most egregious when I use web workers, I think since they bundle several npm libraries, and apparently the entire thing is then leaked. I can crash the Every time a file-save event triggers a build, the node process inches up in memory. (In my case it "inches up" by about 400k RAM on every save). I've bumped Node up to a max of 4GB of RAM which sometimes gets me through a couple hours of dev before it crashes. I'd like to help find the actual cause. What can I do to help?
Hoping these details help us find a real solution! |
which kinds of bad practices will lead to this problem? Can you give me some suggestions? |
It's kind of off-topic, but in server-side Javascript coding it's mostly unreleased event listeners that cause a running software to grow huge over time. When using streams quite frequently it's rather easy to have some recently used event listeners left unreleased. I'd suggest to use unit tests for they can help to find the culprits that prevent a test runner from exiting due to unreleased resources. Apart from that there are other more obvious causes for wasting memory e.g. when caching stuff in memory without cleaning out from time to time or even the simplest algorithms implemented in a wrong way so e.g. arrays are growing huge... In context of VueJS it might be related to accidentally saving references, like working with render() functions or using vm.$el to access some DOM element directly for attaching event listeners which has been bad without VueJS before and so it's still bad today. Caching issues are possible there as well. |
@runxc1 , it throws below error:
i am using like below:
|
Any solution ? |
Well, not in every case can we enlarge the heap size easily. In my practice, i have apps (docker) built for both amd64, arm32v7. And the arm32v7 version is supposed to built on a Raspberry Pi 3B, which only got 1GB ram. It may take longer, but I will eventually get what I need. But when this error occurs, the whole RPi building toolchain fail to deliver. |
Facing the same problem . I have around 300 components and cannot build . Always out of heap memory. |
I have tried rm -R dist |
I have the same problem, trying to solve it for the whole day already. The easy fix everyone suggested is not working:
|
Just disable preetify. It will work. |
How do I do that ? |
Hey, So the problem is even after upping the memory I get something like this:
What I have tried so far
Results in the same problem, just a little later.
AT this point I guess it is due to many scss imports because this project consists out of 20+ dashboards that are completely styled independently. Has someone any suggestion on how I can find the resource devouring process? I guess the original problem for me is that windows allocate memory differently compared to unix systems. I will next try to up swap space on my machine, perhaps this will help. I guess Linux is killing a memory intense process later or not until the swap space is fully exhausted. From what I know by now windows is allocating swap dynamically, and it decides differently whether to kill a process or not - perhaps someone with more knowledge can confirm my guess. |
After restarting vue cli, any variant of
This issue also presents itself ONLY with the Vue CLI, if I run npm run serve from a terminal, this issue doesn't exist. Which kind of points to this being a potential vue clli issue despite @yyx990803 closing this as a "not our problem". |
Is this in anyway a cause of concern for the production app? I am concerned because I am using dynamic components with |
"build": "node --max-old-space-size=8192 node_modules/vite/bin/vite.js build", |
Version
3.0.0-beta.15
Reproduction link
https://github.com/xrei/vuecli-bug
Steps to reproduce
Well.. it's not hard to reproduce but takes time.
Run
yarn serve
and develop for some hours :)
What is expected?
Stable working dev server
What is actually happening?
After some hours (~1-2) dev server will crash with an error:
The text was updated successfully, but these errors were encountered: