Tôi đang cố gắng thiết lập nodejs để truy cập cơ sở dữ liệu postgres. Những gì tôi đã làm cho đến nay là những điều sau đây (https://gist.github.com/579814):Làm thế nào để thiết lập đường dẫn nút cho 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
sau đó
git clone git://github.com/isaacs/npm.git
make
make install
cho đến nay, như vậy tốt. Tuy nhiên, khi tôi cố gắng để cài đặt các trình điều khiển postgres
npm install pg
tôi nhận được như sau:
nút-waf cấu hình xây dựng || đúng
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}
Tôi đã nhìn xung quanh để thiết lập con đường nút, mặc dù đã không tìm thấy bất cứ điều gì giúp đỡ cho đến nay - có lẽ cũng bởi vì tôi là hoàn toàn mới để nodejs, vì vậy tôi muốn được hạnh phúc về bất kỳ gợi ý nào.
Trong phiên bản mới hơn của node.js, npm được bao gồm trong nút. Bạn không cần phải làm 'curl http://npmjs.org/install.sh | sh'. –