i am new to node.js ,so trying to read/write to database, but
i am getting the error while compiling my sql1.js file
sql1.js -->
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'me',
password : 'secret'
});
connection.connect();
connection.query('SELECT 1 + 1 AS solution', function(err, rows, fields) {
if (err) throw err;
console.log('The solution is: ', rows[0].solution);
});
connection.end();
below is the log
pitambar@pitambar-TravelMate-4740:~/node-example/hands-on-node.js$ npm ls installed
better-...@0.1.3 active installed
bignum...@1.0.1 active installed
core-u...@1.0.1 active installed
c...@0.2.1 active installed
debu...@0.0.2 active installed
formi...@1.0.13 active installed
inhe...@2.0.1 active installed
my...@2.0.1 active installed
readabl...@1.1.10 active installed
requi...@0.0.3 active installed
under...@1.5.2 active installed
ut...@0.10.2 active installed
npm ok
pitambar@pitambar-TravelMate-4740:~/node-example/hands-on-node.js$ node sql1.js
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object prototype may only be an Object or null
at Function.create (native)
at Object.inherits (util.js:425:27)
at Object.<anonymous> (/home/pitambar/.node_libraries/.npm/readable-stream/1.1.10/package/lib/_stream_readable.js:55:6)
at Module._compile (module.js:402:26)
at Object..js (module.js:408:10)
at Module.load (module.js:334:31)
at Function._load (module.js:293:12)
at require (module.js:346:19)
at Object.<anonymous> (/home/pitambar/.node_libraries/.npm/readable-stream/1.1.10/package/readable.js:1:90)
at Module._compile (module.js:402:26)
pitambar@pitambar-TravelMate-4740:~/node-example/hands-on-node.js$ ^C
pitambar@pitambar-TravelMate-4740:~/node-example/hands-on-node.js$
what to do in such case,i have googled it but no use,
thank you