Search code examples
nestjstypeorm

No repository for "AlicuotasIva" was found. Looks like this entity is not registered in current "default" connection?


I have an application with nestjs and typeorm. When running in development mode everything works fine.

The error occurs when debugging in vscode.

This is my folder structure

launch.json:

"version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Backend",
            "args": [
                "${workspaceFolder}/backend/src/main.ts"
            ],
            "runtimeArgs": [
                "--nolazy",
                "-r",
                "ts-node/register",
                "-r",
                "tsconfig-paths/register"
            ],
            "sourceMaps": true,
            "cwd": "${workspaceRoot}/backend",
            "console": "integratedTerminal",
            "protocol": "inspector"
        }
    ]

ormconfig.json

{
    "type": "mysql",
    "host": "localhost",
    "port": 3306,
    "username": "root",
    "password": "*",
    "database": "database",
    "entities": ["dist/**/*.entity{.ts,.js}"],
    "supportBigNumbers": true,
    "bigNumberStrings": false,
    "synchronize": false
  }

I appreciate if you can help me


Solution

  • Now if it works, both in debugging and development mode. I clarify that I install dotenv and in my app.module add require ('dotenv'). Config (); Thank you very much