#9738·typeorm

Cannot generate migration: unknown file extension ".ts"

Author: treeconCreated Jan 27, 2023Updated Sep 23, 2026
Labelsbug

Issue description

Cannot generate migration

Expected Behavior

I am running the following command:

typeorm migration:generate path/to/Migration -d ./src/data-source.ts

I would expect the migration file to be generated.

Actual Behavior

The migration is not generated. An error occurs:

Error: Unable to open file: "/path/src/data-source.ts". Unknown file extension ".ts" for /path/src/data-source.ts

Steps to reproduce

Start a typeorm project and try to generate a migration:

npx typeorm migration:generate -d ./src/data-source.ts ./src/migration

My Environment

Dependency Version
Operating System Ubuntu 22.10
Node.js version 16
Typescript version 4.9.4
TypeORM version 0.3.11

Additional Context

No response

Relevant Database Driver(s)

  • aurora-mysql
  • aurora-postgres
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • spanner
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.