我試圖設置nodejs來訪問postgres數據庫。我到目前爲止已經做的是以下(https://gist.github.com/579814):如何設置nodejs的節點路徑(Ubuntu)
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl http://npmjs.org/install.sh | sh
然後
git clone git://github.com/isaacs/npm.git
make
make install
到目前爲止,一切都很好。然而,當我嘗試安裝的Postgres驅動
npm install pg
我得到如下:
節點WAF配置構建||真正
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/binding.cc -> build/default/src/binding_1.o
../src/binding.cc:3:25: 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.cc -> binding_1.o}
我一直在四處尋找設置節點路徑,儘管還沒有發現什麼幫助到目前爲止 - 很可能也是因爲我完全陌生的NodeJS,所以我會很高興關於任何提示。
在較新版本的node.js中,npm包含在節點中。你不需要'curl http://npmjs.org/install.sh | sh'。 –