The error I’m getting looks like this:
[email protected] nbmgu:get ts-node src/main.ts get Error: Cannot find
module ‘src/db/dbv2.service’
the main file looks as follows:
import { AppModule } from './app.module';
import { CommandFactory } from 'nest-commander';
async function bootstrap() {
await CommandFactory.run(AppModule);
}
bootstrap();
The get
command:
@Command({
name: 'get',
description: 'blablabla',
})
export class GetCommand extends CommandRunner {
constructor(private readonly dbv2service: DBv2Service) {
super();
}
async run(
passedParams: string[],
options?: GetCommandOptions,
): Promise<void> {
console.log(cowsay.say({ text: 'Getting data!' }));
await this.dbv2service.fetch();
}
@Option({
flags: '-u, --users [users]',
required: true,
description: 'path to a file with user ids',
})
processUsers(val: string): void {
console.log('processing users...');
console.log(val);
}
}
Looks like this Nest injection does not work because something is missing in the main.ts file. At the moment I cannot find a working solution, I would appreciate some help here.