Sequelize error when giving npx sequelize-cli db:migrate command

Viewed 13

I can create migrations, but when sending them with the command, the console returns the error

ERROR: Error reading "src\config". Error: Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import 'C:\Users\mypc\Documents\my_api\src\config' is not supported resolving ES modules imported from C:\Users\mypc\Documents\my_api\node_modules\sequelize-cli\lib\helpers\import-helper.js

.sequelizerc folder

const path = require('path');

module.exports = {
    'config': path.resolve(__dirname, 'src', 'config'),
    'models-path': path.resolve(__dirname, 'src', 'models'),
    'seeders-path': path.resolve(__dirname, 'src', 'seeders'),
    'migrations-path': path.resolve(__dirname, 'src', 'migrations'),
}

package.json

{
  "dependencies": {
    "body-parser": "^1.20.0",
    "cors": "^2.8.5",
    "dotenv": "^16.0.2",
    "express": "^4.18.1",
    "init": "^0.1.2",
    "nodemon": "^2.0.20",
    "pg": "^8.8.0",
    "pg-hstore": "^2.3.4",
    "sequelize": "^6.22.1",
    "sqlite3": "^5.1.1"
  },
  "name": "my_api",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "dev": "nodemon ./src/server.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": "",
  "devDependencies": {
    "sequelize-cli": "^6.4.1"
  }
}

All my folders are inside src, so I don't know if the problem is in the path configuration, and regarding the import type it's all in commonjs

0 Answers
Related