node.js – Sequelize’方言需要从v4.0.0开始明确提供’

我需要在node.js环境中运行第三方应用程序,但是Sequelize抛出的’Dialect需要从v4.0.0开始明确提供’
我在这里找到类似的话题 Dialect needs to be explicitly supplied as of v4.0.0,但’export NODE_ENV = development’不起作用,我找不到Sequelize配置文件.
我该如何解决这个错误?

这是代码:

const Sequelize = require('sequelize');

const scheme = require('./scheme');

const Op = Sequelize.Op;

const sequelize = new Sequelize(null, null, {

dialect: 'sqlite',
storage: 'db.sqlite3',

operatorsAliases: { $and: Op.and },

logging: false
});

scheme(sequelize);
sequelize.sync();

module.exports.sequelize = sequelize;
module.exports.models = sequelize.models;
你只需在初始化sequelize时提供方言;

const sequelize = new Sequelize('database', 'username', 'password', {
  host: 'localhost',
  dialect: // pick one of 'mysql','sqlite','postgres','mssql',
});
本站公众号
   欢迎关注本站公众号,获取更多程序园信息
开发小院