while a execute npm run typeorm migration:generate -- -n migrationNameHere all is working good and then when i execute npm run typeorm migration:run all the migration are ok in the database , but when i execute npm run start:dev i get an error :
the is the tree of my folders:
this is my ormconfig.json file:
{
"type": "mysql",
"host": "localhost",
"port": 3306,
"username": "root",
"password": "",
"database": "tpicoxxxxx",
"entities": ["dist/**/*.entity{.ts,.js}"],
"migrationsTableName": "migrations_table",
"migrations": ["src/databasesssx/migrations/*{.ts,.js}"],
"cli": {
"migrationsDir": "src/databasesssx/migrations"
}
}
in the package.json file i have the following line in scripts section:
"typeorm": "ts-node-dev ./node_modules/typeorm/cli.js"
i am using typeorm , mysql2
i am using mac big sur.
i thought maybe the problem maybe is because databasesssx folder is outside of src and then i move inside src folder but the problem did not go.
this is my script in registro module:
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { Administrador } from './administrador/entities/administrador.entity';
import { RegistroControllerController } from './registro-controller/registro-
controller.controller';
import { ServiceRegistroService } from './service-registro/service-registro.service';
@Module({
imports : [
TypeOrmModule.forFeature([Administrador]),
],
providers: [ServiceRegistroService],
controllers: [RegistroControllerController]
})
export class RegistroModule {}
and this is the script in app.module
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { RegistroModule } from './registro/registro.module';
@Module({
imports: [RegistroModule ,TypeOrmModule.forRoot()],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
then i tried following the next solution in this site of stack overflow : Similar Problem
but the problem is still there.
By the way i am using xammp in mac with phpmyadmin.
Thank you so much.
start:devnpm-scriptdisttosrcof your ormconfigstart:dev: nest start --watchis inside package.json.