npx sequelize-cli breaking on node 26

Open
#1,570 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
javascript, node.js
Domain
cli

Research direction

Start by reproducing the failure with a .sequelizerc file using require and npx sequelize-cli db:create or --version under Node.js 26. Compare the behavior with Node.js 24 or 25, then trace how sequelize-cli loads the .sequelizerc; done means the documented CommonJS configuration works for projects with "type": "module" without the shown error.

Written by the indexing model from the issue text.

Description

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.

Dominant language
JavaScript
Stars
2.6k
Forks
524
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sequelize/cli

All issues in sequelize/cli

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.