Nodejs Script Killed

Some of the things that I develop are done on a low end VPS. Today I was using metalsmith to create a simple blog/website on a low memory VPS. Metalsmith is a nodejs based static website builder. It's an easy way to use javascript on the server to create static websites.

When one is ready to deploy metalsmith, one runs a command "node build.js" with build.js being the metalsmith build file. Normally this goes through all the source files, and creates a website. However, I tried it and kept getting a "killed" message.

I got no other information than a "killed" message on my linux console when trying to run this node script. At first I thought I screwed something up in the code of my files. Eventually I figured out that it was a memory error. If your node scripts end with just a "killed" message, it is likely that your system is out of memory.

I ran the

dmesg

command to verify this and yep, one of the last entries was:

[92302297.046216] Out of memory in UB 52643: OOM killed process 31724 (node) score 0 vm:783440kB, rss:100756kB, swap:0kB

Clear as day, an out of memory error letting me know that node was killed. Doh.

At this point I have two options, upgrade the VPS or reduce the memory usage on this VPS.

I'm likely just going to upgrade the VPS, as I already run a pretty bare-bone system.