Sequelize 错误:在 Index.js 中未定义 defineCall

Sequelize error: defineCall not defined in Index.js(Sequelize 错误:在 Index.js 中未定义 defineCall)
本文介绍了Sequelize 错误:在 Index.js 中未定义 defineCall的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直收到此续集错误

/node_modules/sequelize/lib/sequelize.js:508
      this.importCache[path] = defineCall(this, DataTypes);
                           ^
    TypeError: defineCall is not a function
    at module.exports.Sequelize.import             (/node_modules/sequelize/lib/sequelize.js:508:32)
at   /models/Index.js:16:33
at Array.forEach (native)
at Object.<anonymous> (/Users/vincentporta/Desktop/RCB_Classwork/cesarcell/models/Index.js:15:4)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)

我已将范围缩小到下面的 Index.js 文件中的注释代码

I've narrowed it down to the commented code in my Index.js file below

使用严格";

var fs        = require("fs");
var path      = require("path");
var Sequelize = require("sequelize");
var config    = require(path.join(__dirname, '..', 'config',    'config.json'))[env];
var sequelize = new Sequelize(config.database, config.username,  config.password, config);
var db        = {};

fs
  .readdirSync(__dirname)
  .filter(function(file) {
    return (file.indexOf(".") !== 0) && (file !== "index.js");
  })

下面这段注释的代码破坏了它<代码>//.forEach(函数(文件){//var model = sequelize.import(path.join(__dirname, file));//db[model.name] = 模型;/

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)
SQL/MySQL: split a quantity value into multiple rows by date(SQL/MySQL:按日期将数量值拆分为多行)