Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
96
rated 0 times [  103] [ 7]  / answers: 1 / hits: 7920  / 4 Years ago, thu, december 10, 2020, 12:00:00

I have cloned a git repository containing a Vue project locally using git clone.
I then ran npm install to install the dependencies and got the node_modules folder.


On running npm run serve I get the following error:


[11920:03BEA178]   321556 ms: Scavenge (reduce) 429.1 (464.7) -> 429.1 (464.7) MB, 37.7 / 17.8 ms  (average mu = 0.980, current mu = 0.932) allocation failure
[11920:03BEA178] 321643 ms: Scavenge (reduce) 429.7 (465.2) -> 429.7 (465.2) MB, 61.2 / 0.9 ms (average mu = 0.980, current mu = 0.932) allocation failure
[11920:03BEA178] 321765 ms: Scavenge (reduce) 432.2 (467.3) -> 432.2 (467.3) MB, 22.1 / 0.0 ms (average mu = 0.980, current mu = 0.932) allocation failure


<--- JS stacktrace --->

FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! [email protected] serve: `vue-cli-service serve --open`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the [email protected] serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:UserssagarAppDataRoamingnpm-cache_logs2020-12-10T09_32_00_595Z-debug.log

Also, my node_modules folder is about 8GB in size. I'm running this on a convertible with 2GB RAM.


More From » node.js

 Answers
5

The way I managed to get past this error was by turning off minimization for TerserPlugin in webpack.config.js as follows:


const TerserPlugin = require('terser-webpack-plugin');
module.exports = {
optimization: {
minimize: false,
minimizer: [new TerserPlugin()],
},
};

This might not work for everyone as, in my opinion, this error occurs when the RAM isn't sufficient. I didn't have to set minimize to false when I ran the app on a laptop with 4GB RAM with much more hard disk space. You can set minimize to false in the development stage and set it back to true when the app is production ready.


[#2148] Friday, December 4, 2020, 4 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
nikhilh

Total Points: 224
Total Questions: 89
Total Answers: 99

Location: Bahrain
Member since Fri, Sep 16, 2022
2 Years ago
nikhilh questions
Fri, Feb 4, 22, 00:00, 2 Years ago
Wed, Jun 9, 21, 00:00, 3 Years ago
Fri, Aug 14, 20, 00:00, 4 Years ago
Sun, May 3, 20, 00:00, 4 Years ago
;