Charles Mwangi
Charles Mwangi

Reputation: 1

I am trying to increase the JavaScript heap memory for my angular application which is causing the app to crash

I am working on an ecommerce application that is multilayered using angular for its frontend. When I serve the application using ng serve the application is served to my local host but later on it crashes and displays a JS out of memory error and it exits.

I tried increasing the heap memory in my local angular and global angular using --max-old-space-size=4096 in both Packages.json file in my root folder and Windows terminal, but I am still getting this error:

error message

Upvotes: 0

Views: 55

Answers (2)

codewithharshad
codewithharshad

Reputation: 361

step:1 => Open your cmd by Run as administrator

step:2 => go to your project path and run Set NODE_OPTIONS="--max-old-space-size=16384"

step:3 => run project ng serve

Upvotes: 0

Bharat Nagdev
Bharat Nagdev

Reputation: 36

Try setting up heap memory size to 8192.

PS: Might not be related but try and delete cache of your angular build from .angular to free up space. It can take space in GBs.

Upvotes: 0

Related Questions