1There are so many repairs:
2
3npm install dotenv
4npm install --dotenv-extended
5
6This worked for me ↓:
7npm install dotenv @latest
8
9*****
10
11And the file must require 'dotenv' like this
12
13require('dotenv').config()
14console.log(process.env.YOURENVVARIABLE)
1
2$ npm install dotenv
3
4//--------------------
5
6on file .env
7//--------------------
8DB_HOST=localhost
9DB_USER=root
10DB_PASS=s1mpl3
11DB_NAME=banco_de_dados
12DB_PORT=3306
13//--------------------
14
15import the config from .env file
16//--------------------
17
18require('dotenv').config()
19module.exports = {
20 username:process.env.DB_USER,
21 password:process.env.DB_PASS,
22 database:process.env.DB_NAME,
23 host:process.env.DB_HOST,
24 dialect:"mysql"
25}
26