NarHakobyan/awesome-nest-boilerplate

Run migration:generate not work!

iafine opened this issue · 6 comments

When I run yarn migration:generate xxx, It not work, and look like is a typeorm cli arguments problem.

typeorm version : 0.3.9

Error detail:

Not enough non-option arguments: got 0, need at least 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nest-typeorm@0.0.1 typeorm: `ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js --config src/ormconfig.ts "entity:create" "-n" "user"`      
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nest-typeorm@0.0.1 typeorm script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\hamja\AppData\Roaming\npm-cache\_logs\2022-03-27T06_06_50_058Z-debug.log

I had the same problem

I had the same problem, How to resolve it?

I had the same problem, Have any luck fixing this issue?

this is the way it works for me, I hope it helps someone.

in package.json

    "typeorm": "ts-node -r tsconfig-paths/register node_modules/typeorm/cli -d ormconfig",
    "migration:generate": "cross-env npm run typeorm -- migration:generate -p true src/database/migrations/$npm_config_name",
    "migration:create": "cross-env ts-node -r tsconfig-paths/register node_modules/typeorm/cli migration:create src/database/migrations/$npm_config_name",

in ormconfig.ts
export default new DataSource(configs as DataSourceOptions);

and to run it use:
npm run migration:generate --name=CreateColors

As I have found they are saying: Unfortunately, the $npm_config feature is not supported by yarn

Hi Guys, typeorm changes migration generate command, use full path instead of naem, yarn migration:generate src/database/migrations/[name]

Miofly commented

Hi Guys, typeorm changes migration generate command, use full path instead of naem, yarn migration:generate src/database/migrations/[name]

this question in main branch remains