-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migration does not work with node 18.19.0 #10537
Comments
same issue when running migrations inside node:18-alpine docker image. it was working fine a few days ago. |
Yes, I am also facing the same issue for the last couple of days. Migrations inside my node:18-alpine Docker image are not working, and it's giving this error
|
I am getting the same problem and can confirm that using Node 18.18.0 is fine but 18.19.0 is not. I've attempted migrations using both For
For
|
The problem also occurs on Node 20.11 We could fix this problem by switching from typeorm-ts-node-esm to typeorm-ts-node-commonjs like mentioned in the docs without changing anything else. @joebrewr You can still use "./datasource.ts" with typeorm-ts-node-commonjs. Seems like typeorm-ts-node-esm was also working for CommonJS projects before Node 18.19, but since 18.19 it only works for ESM projects. |
Thanks, @klangenk. I think I must've been seeing an unrelated error when running |
Its a big mess ! how to pass |
Issue description
typeorm-ts-node-esm migration:run -d does not work with node 18.19
Expected Behavior
typeorm-ts-node-esm migration:run should run the migration process as described
https://orkhan.gitbook.io/typeorm/docs/migrations
This works for node versions 18.18.x
Actual Behavior
Under node version 18.19.0 an error is thrown.
Error during migration run:
Error: Unable to open file: . Cannot use import statement outside a module
Steps to reproduce
Create a file with a function called createDatasource() that returns a Datasource
Create a file called instance.ts what contains
import { createDataSource } from '.';
export const AppDataSource = createDataSourceV2();
run "typeorm-ts-node-esm migration:run -d ./instance.ts" under node 18.19.0
My Environment
| Node.js version | 18.19.0 |
| Typescript version | 5.2.2 |
| TypeORM version | 0.3.17 |
Additional Context
No response
Relevant Database Driver(s)
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.
The text was updated successfully, but these errors were encountered: