Using Sequelize CLI with the ESM package

Stack Overflow Asked by wdGelwix on January 3, 2022

Is there a way to execute Sequelize migrations with the ESM package? It requires the -r esm command line argument to be passed, but I don’t seem to find that in their docs

One Answer

I had the same issue and the way I got around it is by calling sequelize-cli from the node_modules folder.

In my package.json

    "scripts": {
        "migrate": "node --require esm ./node_modules/.bin/sequelize-cli db:migrate"

then if you run npm run migrate it should work with es6 imports.

Answered by Abir Taheer on January 3, 2022

Add your own answers!

Ask a Question

Get help from others!

© 2024 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP