typeorm: typeorm-ts-node-commonjs doesnt work
Issue Description
I am trying to run the typeorm cli using typeorm-ts-node-commonjs to generate migrations and it doesn’t work.
Expected Behavior
It should work.
Actual Behavior
mgarcia:~/projects/compliance-backend-api(chore/add-typeorm)$ npm run typeorm
> compliance-backend-api@0.0.1 typeorm
> typeorm-ts-node-commonjs
/usr/bin/env: ‘node --require ts-node/register’: No such file or directory
Steps to Reproduce
"dependencies": {
"@appsignal/express": "^1.0.23",
"@appsignal/nodejs": "^2.2.10",
"cors": "^2.8.5",
"cross-fetch": "^3.1.5",
"dotenv": "^10.0.0",
"envalid": "^7.2.1",
"express": "^4.17.1",
"express-async-handler": "^1.1.4",
"http-terminator": "^3.0.4",
"pg": "^8.7.3",
"pino-http": "^5.8.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^5.5.12",
"typeorm": "^0.3.4",
"ws": "^3.3.3"
},
"devDependencies": {
"@types/cors": "^2.8.12",
"@types/express": "^4.17.13",
"@types/jest": "^27.0.2",
"@types/node": "^16.10.2",
"@types/pino-http": "^5.8.0",
"@types/supertest": "^2.0.11",
"@types/ws": "^8.2.0",
"@typescript-eslint/eslint-plugin": "^4.32.0",
"@typescript-eslint/parser": "^4.32.0",
"eslint": "^7.32.0",
"jest": "^27.2.4",
"jest-websocket-mock": "^2.2.1",
"mock-socket": "^9.0.5",
"nodemon": "^2.0.13",typeorm-ts-node-commonjs
"supertest": "^6.1.6",
"ts-jest": "^27.0.5",
"ts-node": "^10.2.1",
"tsc-watch": "^4.5.0",
"typescript": "^4.4.3"
},
"engines": {
"node": ">=16.10.0",
"npm": ">=7.24.0"
}
{
"compilerOptions": {
"target": "es5",
"lib": [
"ES6",
"ES5"
], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
"experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
"emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
"module": "commonjs", /* Specify what module code is generated. */
"rootDir": "./src", /* Specify the root folder within your source files. */
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
"paths": {
"*": [
"./node_modules/*"
]
},
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
"outDir": "./dist", /* Specify an output folder for all emitted files. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
},
"exclude": [
"spec/**/*.ts",
]
}
My Environment
| Dependency | Version |
|---|---|
| Operating System | |
| Node.js version | 16.10.0 |
| Typescript version | 4.4.3 |
| TypeORM version | 0.3.4 |
Additional Context
I used npx typeorm init in my current project.
Are you willing to resolve this issue by submitting a Pull Request?
- ✖️ Yes, I have the time, but I don’t know how to start. I would need guidance.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 1
- Comments: 16 (2 by maintainers)
I have the same issue. typeorm-ts-node-esm is broken in the same way.
@marcel-mintouge i am done with typeorm for good(issues from 2019 are still present with a new look), I migrated to drizzle-orm 👌 so good luck to everyone !
I tried everything:
My project compiles to commonjs so I guess the first option is fine but still.