Why does Angular-CLI 'ng build' shows "Killed"?

This is indeed a memory problem. If you can't add extra physical memory, you could create a swap file to add extra RAM memory.

// Create a swapfile
sudo fallocate -l 4G /swapfile

// Set up the swapspace
sudo mkswap /swapfile

// enable swapfile
sudo swapon /swapfile

The swapfile won't be recreated if you reboot. In case you want your swapfile to be permanent, edit the stab file with sudo nano fstab and add the following line to it:

/swapfile   none    swap    sw    0   0

Linux will kill processes when it's low on memory which means your process is eating more memory than there is available. To regulate Node's memory usage you can use:

node --max_old_space_size=1096 ./node_modules/@angular/cli/bin/ng build --prod

where 1096 can be replaced by the memory you have left

Another solution is to add memory, or free it. This can be done by adding swap for example


as from this comment here:

I think this is a memory issue. Linux will kill processes when it's low on memory. See http://stackoverflow.com/questions/30747314/webpack-uglify-plugin-returns-killed-on-ubuntu