cli
cli copied to clipboard
defineCall is not a function
What you are doing?
Import models in my app npx sequelize-cli init:models
const db = require('./models/index.js')
What do you expect to happen?
Import models in my app
What is actually happening?
TypeError: defineCall is not a function
Dialect: sqlite Database version: XXX Sequelize CLI version: 5.5.1 Sequelize version: XXX
Can you post the source of your models/index.js
file?
You may have a line like the following (generated by the CLI init command):
const model = sequelize["import"](path.join(__dirname, file));
Try changing to:
const model = require(path.join(__dirname, file));