I start with node.js and sequelize and I get the following error:
/home/cbaket/test/test.js:9 .complete(function(err) { ^ TypeError: undefined is not a function at Object.<anonymous> (/home/cbaket/test/test.js:9:6) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Function.Module.runMain (module.js:501:10) at startup (node.js:129:16) at node.js:814:3
My file: test.js:
var Sequelize = require('sequelize'); var sequelize = new Sequelize('apidb', 'apidb', 'apidb', { dialect: "mysql", // or 'sqlite', mysql', 'mariadb' port: 3306 // or 5432 (for postgres) }); sequelize .authenticate() .complete(function(err) { if (!!err) { console.log('Unable to connect to the database:', err) } else { console.log('Connection has been established successfully.') } });
I follow one of the early tutorials on the Sequelieze website.
I installed the latest sequelize and mysql with the following command.
$ npm install mysql $ npm install sequelize
I have tried many similar examples and always get the same error. Libraries work because other examples work fine, I can create tables in the database and receive data from it, but the authentication function always fails.
Thanks!;)
source share