Node npm install problem: Killed

I recently started using NodeJS on Ubuntu Server and ran into a few problems with Killed messages during npm install . The same solutions should be applicable to Debian, though the problems could occur on any operating system.

1. npm install  failing on utf-8-validate with Killed

It will look something like this:

While I did not include this package, it was included by one of the packages I did include in my packages.json . Thankfully I found issue #18 which mentions that you need to run a newer version of node.

Ubuntu Server 14.04.3 LTS comes with Node v0.10.40, and as of this writing the latest version is v5.0.0. I found and followed this digital ocean guide to node on ubuntu, however it will not install the very latest version. To do that you need to specify which  setup script to run.

That should get you node on Ubuntu & Debian installs that are 5.x, though you may want to check github repo for an even more up to date script than 5.x.

2. npm install  still returning Killed 

The second problem at first seemed the same as the first, as I was still getting a Killed message. However it seemed to get further along, and depending on the packages I installed would happen in different places. Eventually I found this digital ocean forum post that mentioned that if npm install  runs out memory and swap, it tends to get Killed  partway through. Since I was running a server with extremely small memory footprint, I thought this might be it.

One solution is to increase your swap file if you can.  Or create one if you don’t have one. To do so, you may want to check out this digital ocean forum post and the guide further up the page.

In my case, I was able to increase both the ram and the swapfile through my VM provider, though I did not need to go to 1GB swap but from 256MB to 512MB.

If you have any comments or feedback, I encourage you to send me an email at ofbeaton@gmail.com.

Price
If you found this information useful in fixing your problem, please consider paying the suggested price of $1.00. It will help me host this website and create new projects.