ERROR: Error reading "config\config.js". Error: undefined. Migracion con sequelize-cli
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- javascript
Research direction
Start by reproducing the migration failure with the shown config/config.js and .sequelizerc files, then inspect how sequelize-cli loads the configuration. Check the interaction between the project's module settings and the CLI configuration entry point. Done means sequelize-cli reads the configuration without the reported error and can proceed with the migration.
Written by the indexing model from the issue text.
Description
Hola a todos,
Tengo un problema al ejecutar la migracion con sequelize-cli, recibo el mensaje de error de lectura en el archivo config.js.
Tengo configurado variables de entorno(.env) en la raiz de mi proyecto, no tengo problemas para autenticarme a mi base de datos cuando hago "npm run dev". Estoy trabajado con modulos para las importaciones ("type": "module",).
Agradeceria toda ayuda que sea posible estoy estancado en esto.
gracias.
Mis rutas de directorios:
carpeta raiz
config
- config.js
db
- migrations
- model
- seeders
.env
.sequelizerc
app.js
index.js
...
/* package.json */
"type": "module",
"dependencies": {
"dotenv": "^16.4.5",
"pg": "^8.12.0",
"sequelize": "^6.37.3"
}
"devDependencies": {
"sequelize-cli": "^6.6.2"
}
/* config.js */
import dotenv from "dotenv"
import { Sequelize } from "sequelize"
dotenv.config()
export const development = new Sequelize({
username: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD,
database: process.env.DB_DATABASE,
host: process.env.DB_HOST,
port: process.env.DB_PORT,
dialect: "postgres",
});
export const test = new Sequelize({
username: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD,
database: process.env.DB_DATABASE,
host: process.env.DB_HOST,
port: process.env.DB_PORT,
dialect: "postgres",
});
export const production = new Sequelize({
username: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD,
database: process.env.DB_DATABASE,
host: process.env.DB_HOST,
port: process.env.DB_PORT,
dialect: "postgres",
});
/* .sequelizerc*/
const path = require('path');
module.exports = {
config: path.resolve('config', 'config.js'),
'models-path': path.resolve('db', 'models'),
'seeders-path': path.resolve('db', 'seeders'),
'migrations-path': path.resolve('db', 'migrations'),
};
- Dominant language
- JavaScript
- Stars
- 2.6k
- Forks
- 524
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sequelize/cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·