How to set node path for nodejs (Ubuntu)


I'm trying to setup nodejs to access a postgres database. What I've done so far is the following (

echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl | sh


git clone git://
make install

so far, so good. However, when I try to install the postgres driver

npm install pg

I get the following:

node-waf configure build || true

Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for node path                   : not found 
Checking for node prefix                 : ok /usr/local 
Checking for program pg_config           : /usr/bin/pg_config 
'configure' finished successfully (0.066s)
Waf: Entering directory `/home/christian/node_modules/pg/build'
[1/2] cxx: src/ -> build/default/src/binding_1.o
../src/ fatal error: node_events.h: No such file or directory
compilation terminated.
Waf: Leaving directory `/home/christian/node_modules/pg/build'
Build failed:  -> task failed (err #1): 
    {task: cxx -> binding_1.o}

I've been looking around for setting the node path, although haven't found anything of help so far - probably also because I'm totally new to nodejs, so I'd be happy about any hint.

8/16/2011 10:04:39 AM

Now, you have NodeJS installed in your Ubuntu. You should set /etc/environment and load nodeJS path that can be executed by another users. For example:

6/26/2014 10:34:48 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow