Running Sequelize -m
in my config.json
"development": {
"username": "root",
"password": null,
"database": "**********",
"dialect": "postgres",
"protocol": "postgres",
"port": 5432,
"host": "127.0.0.1"
},
getting error:
sequelize -m
Loaded configuration file "config/config.json".
Using environment "development".
/usr/local/lib/node_modules/sequelize/lib/transaction-manager.js:10
throw new Error("The dialect " + sequelize.getDialect() + " is not support
^
Error: The dialect postgres is not supported.
at new module.exports (/usr/local/lib/node_modules/sequelize/lib/transaction-manager.js:10:11)
at new module.exports.Sequelize (/usr/local/lib/node_modules/sequelize/lib/sequelize.js:128:31)
at Object.<anonymous> (/usr/local/lib/node_modules/sequelize/bin/sequelize:225:27)
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:901:3
Is there a problem in my config, or something else that could be the issue?
I've stumbled upon the same problem. You should install pg
module globally. Here's the command:
npm install -g pg
I have run root@# "npm install pg pg-hstore sequelize --save" and it resolve the issue for me. Thanks !
Nope!
You need to install pg-hstore.
See here: https://github.com/sequelize/sequelize/issues/2949
You need to have
$ npm install pg --save
$ npm install pg-hstore --save
$ npm install sequelize --save
Also create the database separately, sequelize doesn't create the db for you.
var Sequelize = require("sequelize");
// make sure you have created the database using pg Admin III
var sequelize = new Sequelize("postgres://postgres:postgres@localhost:5432/yourdbname");
var Person = sequelize.define('person', {
firstName: {
type: Sequelize.STRING
},
lastName: {
type: Sequelize.STRING
}
});
Person.sync({force: true}).then(function () {
return Person.create({
firstName: 'jj',
lastName: 'Hancock'
});
});
I've run npm install --save pg
inside sequelize directory and everything is fine now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With