Sequelize 'Dialect needs to be explicitly supplied as of v4.0.0'

this worked for me:

'use strict';

const path = require('path');
const Sequelize = require('sequelize');
const db = {};

const DB = 'users';
const USER = 'user';
const PASSWORD = 'password';
const HOST = 'host';
const DIALECT = 'postgres';
const PORT = 5432;

const CONNECTION = new Sequelize(
    DB,
    USER, 
    PASSWORD, 
    {
        host: HOST,
        dialect: DIALECT,
        port: PORT,
    }
)

module.exports.CONNECTION = CONNECTION;

You simply supply the dialect when you initialize sequelize;

const sequelize = new Sequelize('database', 'username', 'password', {
  host: 'localhost',
  dialect: // pick one of 'mysql','sqlite','postgres','mssql',
});

Node cannot find your environment to load in the config file.

You can easily fix by running this

 export NODE_ENV=development; npx sequelize db:migrate

This should export to NODE_ENV the environment needed to run it.