Nodejs: TypeError: Object # <Object> has no 'connect' method

I need to login with facebook and I am using Node.js on the server . But when I run on localhost I get TypeError: Object # does not have a "connect" method.

server.js

// server.js

// set up ======================================================================
// get all the tools we need
var express  = require('express');
var app      = express();
var port     = process.env.PORT || 8080;
var neo4j = require('neo4j');
var passport = require('passport');
var flash    = require('connect-flash');

var configDB = require('./config/database.js');

// configuration ===============================================================
neo4j.connect(configDB.url); // connect to our database

require('./config/passport')(passport); // pass passport for configuration

app.configure(function() {

    // set up our express application
    app.use(express.logger('dev')); // log every request to the console
    app.use(express.cookieParser()); // read cookies (needed for auth)
    app.use(express.bodyParser()); // get information from html forms

    app.set('view engine', 'ejs'); // set up ejs for templating

    // required for passport
    app.use(express.session({ secret: 'heyhellopeoplediscoverapp' })); // session secret
    app.use(passport.initialize());
    app.use(passport.session()); // persistent login sessions
    app.use(flash()); // use connect-flash for flash messages stored in session

});

// routes ======================================================================
require('./app/routes.js')(app, passport); // load our routes and pass in our app and fully configured passport

// launch ======================================================================
app.listen(port);
console.log('The magic happens on port ' + port);

      

Below is the error I got from the console:

neo4j.connect(configDB.url); // connect to our database
      ^
TypeError: Object #<Object> has no method 'connect'
    at Object.<anonymous> (C:\node\easy-node-authentication-facebook\server.js:1
5:7)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3

      

Thanks in advance!

+3


source to share


1 answer


Based on the npm info, you need to create a database instance, which will then have a connect method var db = new neo4j.GraphDatabase (configDB.url); db.connect ();



+1


source







All Articles