Archive for the ‘node.js’ Category

I was having lots of difficulties to install node.js / npm on a server running CentOS 5. The node.js documentation mentions that we should be adding the EPEL repository and then using “yum install npm” to install it. However, no matter how much I tried, this package seems unavailable on CentOS 5. Compiling from source was a solution but I really did not want to install all the development tools on that machine that is essentially just a testing server. All I needed node.js for was to run tests from the mocha test framework.

After much research I finally found an answer on serverfault (a branch of StackOverflow). It suggests to use nave, a virtual environment for node that will install npm and node.js just for the local user. Turns out this is exactly what I wanted since it would simplify the migration if I need to move my testing environment to another server.

This is the exact same implementation that we used to build ThreatWiki with Mongoose. Quick and fast to implement.

One thing that surprised me about this guide is that it recommends to specify the option “safe” mode for the connection with mongoDB. The safe mode is the mode that guarantees that you will be informed by an error if a write to the database fails (in the default implementation of MongoDB it’s off by default to increase speed).