cli icon indicating copy to clipboard operation
cli copied to clipboard

defineCall is not a function

Open tomderudder opened this issue 4 years ago • 2 comments

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

tomderudder avatar Mar 05 '20 23:03 tomderudder

image

tomderudder avatar Mar 05 '20 23:03 tomderudder

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));

mtjn avatar May 08 '20 09:05 mtjn