Skip to content

npx sequelize-cli breaking on node 26 #1570

Open

Description

@ranupratapsingh

Issue Creation Checklist

  • I understand that my issue will be automatically closed if I don't fill in the requested information
  • I have read the contribution guidelines

Bug Description

When using sequelize-cli in a project having "type": "module" with a .js config file path (via .sequelizerc), commands(even npx sequeliize-cli --version) break with follwing error trace

ReferenceError: require is not defined in ES module scope, you can use import instead
    at file:///Users/rpsingh/dev/sif_ms/.sequelizerc:1:14
    at ModuleJobSync.runSync (node:internal/modules/esm/module_job:673:37)

Reproducible Example

  1. Create a .sequelizerc file:
const path = require('path');

module.exports = {
  'config': path.resolve('config', 'database.js'),
  'models-path': path.resolve('app', 'models'),
  'seeders-path': path.resolve('db', 'seeders'),
  'migrations-path': path.resolve('db', 'migrations')
}
  1. Run:
npx sequelize-cli db:create

What do you expect to happen?

db should be created.

What is actually happening?

Following erorr is occuring

npx sequelize-cli --version
file:///Users/rpsingh/dev/sif_ms/.sequelizerc:1
const path = require('path');
             ^

ReferenceError: require is not defined in ES module scope, you can use import instead
    at file:///Users/rpsingh/dev/sif_ms/.sequelizerc:1:14
    at ModuleJobSync.runSync (node:internal/modules/esm/module_job:673:37)
    at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:350:47)
    at loadESMFromCJS (node:internal/modules/cjs/loader:1752:24)
    at Module._compile (node:internal/modules/cjs/loader:1916:5)
    at Object..js (node:internal/modules/cjs/loader:2074:10)
    at Module.load (node:internal/modules/cjs/loader:1656:32)
    at Module._load (node:internal/modules/cjs/loader:1448:12)
    at wrapModuleLoad (node:internal/modules/cjs/loader:261:19)
    at Module.require (node:internal/modules/cjs/loader:1679:12)

Node.js v26.5.0

Environment

  • Sequelize-cli version: 6.6.5
  • Node.js version: 26.5.0
  • If TypeScript related: N/A
  • Database & Version: N/A
  • Connector library & Version: N/A

More info

This bug is not occuring in node version 24 or 25.

Activity

  1. Abhinav1217 commented on Nov 2, 2026

    @Abhinav1217

    Came here to report exact same thing.

    My current workaround is to rename .sequelizerc to .sequelizerc.cjs and then add the --options-path on every command in the script. But this is just a patch and an overhead. We already had to add a package.json inside the migration and seeder folder to mark it as commonjs, when we moved to esm last year. Now this. I love sequelize over prisma (or worst.. typeorm) but there is only so much we can do to carry the weight of legacy code.

    Image
  2. WikiRik commented on Nov 2, 2026

    @WikiRik
    Member

    We're reworking the CLI to be ESM only in v7 and that will have support for Node 24. We're aiming for a v7 release end of this year or early next year. There's a decent chance that we're not going to update v6 CLI because of all the legacy Node versions it supports

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions