Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

541
Views
dataSource flag in typeorm cli

I'm starting a project with typeorm. My configuration file looks like this:

ormconfig.js

import dotenv from 'dotenv'
dotenv.config();


const {
    DATABASE_HOST,
    DATABASE_PORT,
    DATABASE_NAME,
    DATABASE_PASSWORD
} = process.env




export default {
    type: 'postgres',
    host: DATABASE_HOST,
    port: DATABASE_PORT,
    database: DATABASE_NAME,
    password: DATABASE_PASSWORD,
    entities: [
        "./api/modules/documents/entity/*.js",
    ],
    migrations: [
        "./api/database/migrations/*.js",
    ],
    cli: {
        migrationsDir: "./api/database/migrations",
        entitiesDir: "api/database/modules/**/entity"
    }
}

package.json scripts

"scripts": {
    "gulp": "node_modules/gulp-cli/bin/gulp.js",
    "start": "nodemon ./src/app.js",
    "start:api": "nodemon ./api/server.js",
    "typeorm": "node ./node_modules/typeorm/cli.js --config ./ormconfig.js"
},

When i try to run the command yarn typeorm migration:run its show this message:

Runs all pending migrations.

Opções:
  -h, --help         Exibe ajuda                                      [booleano]
  -d, --dataSource   Path to the file where your DataSource instance is defined.
                                                                   [obrigatório]
  -t, --transaction  Indicates if transaction should be used or not for
                     migration run. Enabled by default.      [padrão: "default"]
  -v, --version      Exibe a versão                                   [booleano]

Missing required argument: dataSource

What would be datasource flag? I tried with typeorm cli installed globally, same problem happens

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Looks like you are using typeorm 0.3.x in your project while you are following 0.2.x configurations. Check your installed version on your package.json.

If you are using 0.3.x and want to keep with the current version you should follow the documentation: https://typeorm.io/data-source

Otherwise you can just downgrade your version executing:

npm install typeorm@0.2.45
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!