TypeOrm migration – Error: Cannot find module

I’m trying npm run typeorm migration:run in my project and it is showing the error below.

Error during migration run: Error: Cannot find module ‘src/permission/permission.entity’

Error during migratino run: Cannot find module 'permission'

ormconfig.js

module.exports = {
  type: 'mysql',
  host: 'localhost',
  port: 33066,
  username: 'root',
  password: '123456',
  database: 'admin',
  synchronize: false,
  entities: ['./src/**/*.entity.ts'],
  migrations: ['./src/migrations/*.ts'],
  cli: {
    entitiesDir: './ts/',
    migrationsDir: './src/migrations',
  },
};

What am I doing wrong? This is my git repo: https://github.com/wesoz/udemy-nest-admin/tree/td/seed

Answer

You need to use a relative import path.

import { Permission } from '../permission/permission.entity';