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

604
Views
Error TypeORM al intentar crear una migración en CLI

Estoy tratando de usar TypeORM CLI para crear una migración. Seguí su guía, pero cuando yarn run typeorm migration:generate , aparece el error:

 $ typeorm-ts-node-commonjs migration:generate /usr/bin/env: 'node --require ts-node/register': No such file or directory /usr/bin/env: use -[v]S to pass options in shebang lines error Command failed with exit code 127.

Mi paquete.json se ve así:

 { "name": "server", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "watch": "tsc -w", "start": "node dist/index.js", "dev": "nodemon dist/index.js", "start2": "ts-node src/index.ts", "dev2": "nodemon --exec ts-node src/index.ts", "typeorm": "typeorm-ts-node-commonjs" }, "author": "", "license": "ISC", "dependencies": { "apollo-server-express": "^3.6.7", "class-validator": "^0.13.2", "cors": "^2.8.5", "express": "^4.17.3", "express-graphql": "^0.12.0", "graphql": "^15.3.0", "pg": "^8.7.3", "reflect-metadata": "^0.1.13", "ts-node": "^10.7.0", "type-graphql": "^1.1.1", "typeorm": "^0.3.4" }, "devDependencies": { "@types/express": "^4.17.13", "@types/node": "^17.0.23", "nodemon": "^2.0.15", "typescript": "^4.6.3" } }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Logré resolver esto instalando el cli como se describe aquíhttps://orkhan.gitbook.io/typeorm/docs/using-cli#installing-cli

Instale ts-node globalmente npm install -g ts-node

agregue el siguiente script a package.json: "typeorm": "node --require ts-node/register ./node_modules/typeorm/cli.js" en lugar de "typeorm": "typeorm-ts-node-commonjs"

luego cree una migración con: yarn run typeorm migration:generate -p -d src/data-source.ts src/migrations/<filename without ending>

FYI Para cualquiera que enfrente problemas similares: me tomó un tiempo darme cuenta de que las diversas documentaciones en typeorm son confusas y contradictorias en este momento porque acaban de pasar a v0.3.0 y no todo se ha actualizado.

about 4 years ago · Juan Pablo Isaza 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!