i'am configuring nestjs ormconfig.json but typeorm don't connect to mysql 8 database, it display this in cli
[Nest] 13324 - 2020-01-14 4:15:32 [NestFactory] Starting Nest application...
[Nest] 13324 - 2020-01-14 4:15:32 [InstanceLoader] AppModule dependencies initialized +513ms
[Nest] 13324 - 2020-01-14 4:15:32 [InstanceLoader] TypeOrmModule dependencies initialized +5ms
[Nest] 13324 - 2020-01-14 4:15:36 [TypeOrmModule] Unable to connect to the database. Retrying (1)... +4061ms
Error: Cannot find module 'src/user/user.entity'
Require stack:
- C:\Users\redwolf\Labs\projets-pro\kissing-api\src\appel\appel.entity.ts
- C:\Users\redwolf\Labs\projets-pro\kissing-api\node_modules\typeorm\platform\PlatformTools.js
- C:\Users\redwolf\Labs\projets-pro\kissing-api\node_modules\typeorm\driver\sqlserver\SqlServerDriver.js
- C:\Users\redwolf\Labs\projets-pro\kissing-api\node_modules\typeorm\migration\MigrationExecutor.js
- C:\Users\redwolf\Labs\projets-pro\kissing-api\node_modules\typeorm\connection\Connection.js
- C:\Users\redwolf\Labs\projets-pro\kissing-api\node_modules\typeorm\connection\ConnectionManager.js
- C:\Users\redwolf\Labs\projets-pro\kissing-api\node_modules\typeorm\index.js
- C:\Users\redwolf\Labs\projets-pro\kissing-api\node_modules\@nestjs\typeorm\dist\common\typeorm.utils.js
- C:\Users\redwolf\Labs\projets-pro\kissing-api\node_modules\@nestjs\typeorm\dist\common\typeorm.decorators.js
- C:\Users\redwolf\Labs\projets-pro\kissing-api\node_modules\@nestjs\typeorm\dist\common\index.js
- C:\Users\redwolf\Labs\projets-pro\kissing-api\node_modules\@nestjs\typeorm\dist\index.js
- C:\Users\redwolf\Labs\projets-pro\kissing-api\node_modules\@nestjs\typeorm\index.js
- C:\Users\redwolf\Labs\projets-pro\kissing-api\src\app.module.ts
- C:\Users\redwolf\Labs\projets-pro\kissing-api\src\main.ts
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
at Function.Module._load (internal/modules/cjs/loader.js:690:27)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (C:\Users\redwolf\Labs\projets-pro\kissing-api\src\appel\appel.entity.ts:3:1)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Module.m._compile (C:\Users\redwolf\Labs\projets-pro\kissing-api\node_modules\ts-node\src\index.ts:806:23)
at Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Object.require.extensions.<computed> [as .ts] (C:\Users\redwolf\Labs\projets-pro\kissing-api\node_modules\ts-node\src\index.ts:809:12)
at Module.load (internal/modules/cjs/loader.js:815:32)
all entities are in src folder but the console still say the're not
and this is my code
app.module.ts
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
@Module({
imports: [
TypeOrmModule.forRoot(),
],
})
export class AppModule {}
ormconfig.json
{
"type": "mysql",
"host": "localhost",
"port": 3306,
"username": "admin",
"password": "",
"database": "kissing_db",
"synchronize": true,
"logging": true,
"entities": [
"src/**/*.entity.ts",
"dist/**/*.entity.js"
],
"migrationsTableName": "migration",
"migrations": [
"src/migration/*.ts"
],
"cli": {
"migrationsDir": "./src/migration"
},
"ssl": false
}
I don't post it with password for security reason hope you'll understand.