Properly installing SQLite for Node.js

I follow the instructions on installing SQLite for Node.js:

apt-get install sqlite3
apt-get install libsqlite3-dev
npm install sqlite3

Still, the code

var db = new require('sqlite3').verbose().Database('database.db');

results in the error message:

./node: symbol lookup error: /root/together2/node_modules/sqlite3/lib/sqlite3_bindings.node: undefined symbol: _ZN2v814ObjectTemplate11SetAccessorENS_6HandleINS_6StringEEEPFNS1_INS_5ValueEEENS_5LocalIS2_EERKNS_12AccessorInfoEEPFvS7_NS6_IS4_EESA_ES5_NS_13AccessControlENS_17PropertyAttributeE

The system is:

cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.2 LTS"

Can anyone explain what am I missing here?

That error appears to me that you are attempting to use the sqlite3 package with a different build of node.js than it was built for, hence the missing symbol. You should rebuild the package against the version of node.js that you are requiring it from.