[Vuejs]-Javascript heap out of memory when npm run serve in vuejs project?

0👍

I found the solution. cd to your project directory and type npm run lint. This will show all the errors in vue project, try removing those errors and vuejs project will run fine without throwing heap out of memory error. cheers

0👍

If you have a large project with each .less file in every folder(such as components, views) you may have this problem.

I have solved it by move all .less file into just one folder
“/assets/less/” and import all of them to “/assets/less/index.less”

Another option is adding a script to package.json, so you can run “npm run dev” instead of “npm run serve”. But this option will not resolved the root of this problem.

"dev": "npx --max_old_space_size=4096 vue-cli-service serve"

Leave a comment