node.js forever on the raspberry

Running node.js as a testing environment, including forever, before I push any projects to one of my servers, seemed like a very good idea. Yesterday I found out that if you try to run forever with the nodejs package from the apt repository in raspbian wheezy, you're gonna have a bad time:

Forever crashing on raspbian

geronimo@himbeerchen ~ $ forever list

    throw new Error("Cannot find module '" + request + "'");
Error: Cannot find module './daemon.v0.6.19'
    at Function._resolveFilename (module.js:337:11)
    at Function._load (module.js:279:25)
    at Module.require (module.js:359:17)
    at require (module.js:375:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/forever/node_modules/daemon/lib/daemon.js:12:11)
    at Module._compile (module.js:446:26)
    at Object..js (module.js:464:10)
    at Module.load (module.js:353:32)
    at Function._load (module.js:311:12)
    at Module.require (module.js:359:17)

This is just an example of running forever and there were not processes running, still after I got it working correctly, you would see:

geronimo@himbeerchen ~ $ forever list
info:    No forever processes running

Forever working on raspbian

To make it all work neatly, you just have to follow the node.js download page instructions for debian, which basically is the following commands:

apt-get install python g++ make
mkdir ~/nodejs && cd $_
wget -N
tar xzvf node-latest.tar.gz && cd `ls -rd node-v*`
make install

I guess forever isn't the only module affected by this, but it's the one I ran into. Most likely because of outdated versions of node in the apt repositories.

Tagged with: #node.js

Thank you for reading! If you have any comments, additions or questions, please tweet or toot them at me!