Migrations CLI fail with error: TypeError: dataSourceFileExports is not iterable
See original GitHub issueIssue Description
Steps to Reproduce
I am following the documentation and installing typeORM with the command:
npx typeorm init --name MyProject --database postgres
running migrations with this command:
yarn typeorm migration:show -d ./src/data-source.ts
will fail with the error:
TypeError: dataSourceFileExports is not iterable at Function.loadDataSource (/Users/GitHub/MyProject/src/commands/CommandUtils.ts:37:34) at async Object.handler (/Users/GitHub/MyProject/src/commands/MigrationShowCommand.ts:27:26)
data-source.ts looks like this:
import "reflect-metadata"
import { DataSource } from "typeorm"
import { User } from "./entity/User"
export const AppDataSource = new DataSource({
type: "postgres",
host: "localhost",
port: 5432,
username: "test",
password: "test",
database: "test",
synchronize: true,
logging: false,
entities: [User],
migrations: [],
subscribers: [],
})
My Environment
Dependency | Version |
---|---|
Operating System | MacOS |
Node.js version | v18.8.0 |
Typescript version | 4.5.2 |
TypeORM version | 0.3.8 |
Are you willing to resolve this issue by submitting a Pull Request?
- ✖️ Yes, I have the time, and I know how to start.
- ✅ Yes, I have the time, but I don’t know how to start. I would need guidance.
- ✖️ No, I don’t have the time, but I can support (using donations) development.
- ✖️ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
Issue Analytics
- State:
- Created a year ago
- Reactions:8
- Comments:13 (1 by maintainers)
Top Results From Across the Web
Typeorm CLI not usable - Running CLI returns: TypeError ...
typeorm.config.ts Error during migration generation: TypeError: dataSourceFileExports is not iterable at Function.
Read more >Error when creating a new migration using TypeORM and ...
I have a node application using typescript and I'm trying to create a new migration, following the documentation of the TypeORM. First I ......
Read more >Migrations - typeorm - GitBook
A migration is just a single file with sql queries to update a database schema and apply new changes to an existing database....
Read more >27884 (Document that validators needs to be an iterable since ...
However, if this migration is loaded by Django 1.11 when running migrate or makemigrate or ... later TypeError: 'MinValueValidator' object is not iterable....
Read more >Upgrade Sentry 20.9 to 21.3 - On-Premise
@BYK Running migrations: Applying ... filter_expr TypeError: 'int' object is not iterable An error occurred, ... Parsing command line .
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Downgrade to 0.3.4 solved the issue on my side (temporary solution).
Also, don’t forget to force the version “0.3.4” in package.json and not set it like “^0.3.4” because in that case, it will be the buggy 0.3.8 version that will be installed 😉
Downgrade to 0.3.7 solved the issue on my side (temporary solution).
Also, don’t forget to force the version “0.3.7” in package.json and not set it like “^0.3.7” because in that case, it will be the buggy 0.3.8 version that will be installed 😉