Error loading modules in nodejs, node and nom installed using repos Ubuntu

I have installed nodejs and npm using repos in Ubuntu 12.10, and generally I install a module using

sudo npm install -g nodemodule

but when I try to do var mod = require("nodemodule") I receive an error I have to use require("/usr/lib/node_modules/nodemodule"), how canI fix this?

You probably need to set the NODE_PATH environment variabele:

export NODE_PATH=/usr/lib/node_modules/:$NODE_PATH

After that, try your Node script again. If it works, place the line above in your shells' startup file (usually ~/.bashrc) so it will always be set when you log in.