Closed Sotatek-TyPham closed 1 year ago
Do you get an error?
Please provide a minimum reproduction repository (Git repository/StackBlitz/CodeSandbox project).
@jmcdo29 No any error, please try https://github.com/typv/nest-commander
@jmcdo29 No any error, please try typv/nest-commander
This isn't a minimum reproduction. I shouldn't have to set up a database for this, right? Your reproduction currently requires me to. Please follow the instructions in the link I provided about what a minimum reproduction is.
@jmcdo29 This is a test repository and I have provided you the docker-compose.yml.
After adding in a Logger
to debug
pnpm build
> nest-typescript-starter@1.0.0 build /home/jay/Documents/code/help/nest-commander
> nest build
nest-commander at on master [ ] via v16.18.0 with took 4s
❯ node dist/src/cli.js create-admin
[Nest] 38796 - 10/24/2022, 9:52:49 PM LOG [NestFactory] Starting Nest application...
[Nest] 38796 - 10/24/2022, 9:52:49 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
MissingDriverError: Wrong driver: "undefined" given. Supported drivers are: "aurora-mysql", "aurora-postgres", "better-sqlite3", "capacitor", "cockroachdb", "cordova", "expo", "mariadb", "mong
at DriverFactory.create (/home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/typeorm@0.3.10_xfe65cbtrj7nyogdydel56wvce/node_modules/typeorm/driver/DriverFactory.js:72:23)
at new DataSource (/home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/typeorm@0.3.10_xfe65cbtrj7nyogdydel56wvce/node_modules/typeorm/data-source/DataSource.js:49:59)
at createTypeormDataSource (/home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/@nestjs+typeorm@9.0.1_v5sk3sol6y4pjqg44yrie3mozm/node_modules/@nestjs/typeorm/dist/typeorm-core.
at Function.<anonymous> (/home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/@nestjs+typeorm@9.0.1_v5sk3sol6y4pjqg44yrie3mozm/node_modules/@nestjs/typeorm/dist/typeorm-core.mod
at Generator.next (<anonymous>)
at /home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/@nestjs+typeorm@9.0.1_v5sk3sol6y4pjqg44yrie3mozm/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:20:71
at new Promise (<anonymous>)
at __awaiter (/home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/@nestjs+typeorm@9.0.1_v5sk3sol6y4pjqg44yrie3mozm/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:16:1
at /home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/@nestjs+typeorm@9.0.1_v5sk3sol6y4pjqg44yrie3mozm/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:174:76
at Observable._subscribe (/home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/rxjs@7.5.7/node_modules/rxjs/dist/cjs/internal/observable/defer.js:8:31)
[Nest] 38796 - 10/24/2022, 9:52:49 PM LOG [InstanceLoader] CommandRootModule dependencies initialized +3ms
[Nest] 38796 - 10/24/2022, 9:52:49 PM LOG [InstanceLoader] TypeOrmModule dependencies initialized +0ms
[Nest] 38796 - 10/24/2022, 9:52:49 PM LOG [InstanceLoader] DiscoveryModule dependencies initialized +0ms
[Nest] 38796 - 10/24/2022, 9:52:49 PM LOG [InstanceLoader] CommandRunnerModule dependencies initialized +1ms
[Nest] 38796 - 10/24/2022, 9:52:52 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...
MissingDriverError: Wrong driver: "undefined" given. Supported drivers are: "aurora-mysql", "aurora-postgres", "better-sqlite3", "capacitor", "cockroachdb", "cordova", "expo", "mariadb", "mong
at DriverFactory.create (/home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/typeorm@0.3.10_xfe65cbtrj7nyogdydel56wvce/node_modules/typeorm/driver/DriverFactory.js:72:23)
at new DataSource (/home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/typeorm@0.3.10_xfe65cbtrj7nyogdydel56wvce/node_modules/typeorm/data-source/DataSource.js:49:59)
at createTypeormDataSource (/home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/@nestjs+typeorm@9.0.1_v5sk3sol6y4pjqg44yrie3mozm/node_modules/@nestjs/typeorm/dist/typeorm-core.
at Function.<anonymous> (/home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/@nestjs+typeorm@9.0.1_v5sk3sol6y4pjqg44yrie3mozm/node_modules/@nestjs/typeorm/dist/typeorm-core.mod
at Generator.next (<anonymous>)
at /home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/@nestjs+typeorm@9.0.1_v5sk3sol6y4pjqg44yrie3mozm/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:20:71
at new Promise (<anonymous>)
at __awaiter (/home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/@nestjs+typeorm@9.0.1_v5sk3sol6y4pjqg44yrie3mozm/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:16:12)
at /home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/@nestjs+typeorm@9.0.1_v5sk3sol6y4pjqg44yrie3mozm/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:174:76
at Observable._subscribe (/home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/rxjs@7.5.7/node_modules/rxjs/dist/cjs/internal/observable/defer.js:8:31)
[Nest] 38796 - 10/24/2022, 9:53:01 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (5)...
MissingDriverError: Wrong driver: "undefined" given. Supported drivers are: "aurora-mysql", "aurora-postgres", "better-sqlite3", "capacitor", "cockroachdb", "cordova", "expo", "mariadb", "mongodb", "mssql", "mysql", "nativescript", "oracle", "postgres", "react-native", "sap", "sqlite", "sqljs", "spanner".
at DriverFactory.create (/home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/typeorm@0.3.10_xfe65cbtrj7nyogdydel56wvce/node_modules/typeorm/driver/DriverFactory.js:72:23)
at new DataSource (/home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/typeorm@0.3.10_xfe65cbtrj7nyogdydel56wvce/node_modules/typeorm/data-source/DataSource.js:49:59)
at createTypeormDataSource (/home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/@nestjs+typeorm@9.0.1_v5sk3sol6y4pjqg44yrie3mozm/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:172:23)
at Function.<anonymous> (/home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/@nestjs+typeorm@9.0.1_v5sk3sol6y4pjqg44yrie3mozm/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:176:46)
at Generator.next (<anonymous>)
at /home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/@nestjs+typeorm@9.0.1_v5sk3sol6y4pjqg44yrie3mozm/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:20:71
at new Promise (<anonymous>)
at __awaiter (/home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/@nestjs+typeorm@9.0.1_v5sk3sol6y4pjqg44yrie3mozm/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:16:12)
at /home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/@nestjs+typeorm@9.0.1_v5sk3sol6y4pjqg44yrie3mozm/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:174:76
at Observable._subscribe (/home/jay/Documents/code/help/nest-commander/node_modules/.pnpm/rxjs@7.5.7/node_modules/rxjs/dist/cjs/internal/observable/defer.js:8:31)
I can't just run the reproduction. So please, make it so that I can.
@jmcdo29 I found the error of import Typeorm to CommandModule, it not related to nest-commander. Sorry for that and thanks for your support.
Is there an existing issue for this?
Current behavior
Command "crun create-admin" not working
Minimum reproduction code
CommandModule
CreateAdminCommand
CreateAdminQuestions
cli.js
package.json
Then run: "crun create-admin" and nothing happen.
Expected behavior
That command runs exactly.
Package
nest-commander
nest-commander-schematics
nest-commander-testing
Package version
3.1.0
Node.js version
16.18.0
In which operating systems have you tested?
Other
NestJs v9