Mikro-orm: cant build nestjs app from version 4.1

Created on 16 Oct 2020  路  4Comments  路  Source: mikro-orm/mikro-orm

Hi thanks for your great lib
form version 4.1 I cant build my projects and get this error

node_modules/@mikro-orm/migrations/typings.d.ts:7:9 - error TS2300: Duplicate identifier 'migrationsList'.
   migrationsList(migrations: MigrationDefinitionWithName[], parameters?: any[]): UmzugMigration[];
   node_modules/@types/umzug/index.d.ts:265:9
   migrationsList: (migrations: MigrationDefinitionWithName[], parameters?: any[]) => Migration[];
   'migrationsList' was also declared here.
  node_modules/@types/umzug/index.d.ts:265:9 - error TS2300: Duplicate identifier 'migrationsList'.
 migrationsList: (migrations: MigrationDefinitionWithName[], parameters?: any[]) => Migration[];
  node_modules/@mikro-orm/migrations/typings.d.ts:7:9
  migrationsList(migrations: MigrationDefinitionWithName[], parameters?: any[]): UmzugMigration[];
 'migrationsList' was also declared here.

also this is my package file

"scripts": {
    "prebuild": "rimraf dist",
    "build": "nest build",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "start": "nest start",
    "start:dev": "nest start --watch",
    "start:debug": "nest start --debug --watch",
    "start:prod": "node dist/main",
    "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "jest --config ./test/jest-e2e.json"
  },
  "dependencies": {
    "@mikro-orm/core": "^4.1.0",
    "@mikro-orm/nestjs": "^4.2.0",
    "@mikro-orm/postgresql": "^4.1.0",
    "@mikro-orm/reflection": "^4.1.0",
    "@mikro-orm/sql-highlighter": "^1.0.1",
    "@nestjs/common": "^7.4.4",
    "@nestjs/config": "^0.5.0",
    "@nestjs/core": "^7.4.4",
    "@nestjs/jwt": "^7.1.0",
    "@nestjs/platform-fastify": "^7.4.4",
    "@nestjs/platform-socket.io": "^7.4.4",
    "@nestjs/swagger": "^4.6.1",
    "@nestjs/websockets": "^7.4.4",
    "nestjs-minio": "^2.0.9",
    "nestjs-redis": "^1.2.8",
    "argon2": "^0.27.0",
    "casbin": "^5.1.6",
    "class-transformer": "^0.3.1",
    "class-validator": "^0.12.2",
    "dotenv": "^8.2.0",
    "faker": "^5.1.0",
    "fastify-multipart": "^3.2.1",
    "fastify-swagger": "^3.4.0",
    "mime-types": "^2.1.27",
    "moment": "^2.29.1",
    "pg": "^8.4.1",
    "point-of-view": "^4.6.0",
    "qs": "^6.9.4",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^6.6.3",
    "typeorm": "^0.2.28",
    "typeorm-adapter": "^1.2.0"
  },
  "devDependencies": {
    "@mikro-orm/cli": "^4.1.0",
    "@nestjs/cli": "^7.5.1",
    "@nestjs/schematics": "^7.1.2",
    "@nestjs/testing": "^7.4.4",
    "@types/faker": "^5.1.2",
    "@types/jest": "26.0.14",
    "@types/mime-types": "^2.1.0",
    "@types/minio": "^7.0.6",
    "@types/node": "^14.11.10",
    "@types/qs": "^6.9.5",
    "@types/socket.io": "^2.1.11",
    "@types/supertest": "^2.0.10",
    "@typescript-eslint/eslint-plugin": "^4.4.1",
    "@typescript-eslint/parser": "^4.4.1",
    "eslint": "^7.11.0",
    "eslint-config-prettier": "^6.13.0",
    "eslint-plugin-import": "^2.22.1",
    "jest": "^26.5.3",
    "prettier": "^2.1.2",
    "supertest": "^5.0.0",
    "ts-jest": "26.4.1",
    "ts-loader": "^8.0.5",
    "ts-node": "^9.0.0",
    "tsconfig-paths": "^3.9.0",
    "typescript": "^4.0.3"
  },
  "mikro-orm": {
    "useTsNode": true,
    "configPaths": [
      "./src/mikro-orm.config.ts",
      "./dist/mikro-orm.config.js"
    ]
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": "src",
    "testRegex": ".spec.ts$",
    "transform": {
      "^.+\\.(t|j)s$": "ts-jest"
    },
    "coverageDirectory": "../coverage",
    "testEnvironment": "node"
  }

and this is my tsconfig

{
  "compilerOptions": {
    "module": "commonjs",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "target": "es2017",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "paths": {
      "@src/*": ["src/*"],
      "@configs": ["src/configs"]
    }
  }
}

Most helpful comment

It is fixed (yesterday), but not released yet - will be shipping 4.2 today probably.

Not sure why the downvotes, I just stated what the root cause is, and closed it with an actual fix...

Btw simple workaround is to fix resolution of @types/umzug to 2.2 in your project (yarn supports this, not sure about npm).

All 4 comments

Looks like the PR with updated typings for umzug is finally merged.

Faced the same problem with the latest 4.1.0 version
Not sure that this issue has been resolved

It is fixed (yesterday), but not released yet - will be shipping 4.2 today probably.

Not sure why the downvotes, I just stated what the root cause is, and closed it with an actual fix...

Btw simple workaround is to fix resolution of @types/umzug to 2.2 in your project (yarn supports this, not sure about npm).

It is fixed (yesterday), but not released yet - will be shipping 4.2 today probably.

Not sure why the downvotes, I just stated what the root cause is, and closed it with an actual fix...

Thank you for providing the info 馃憤
Will check this workaround

UPD: checked with @types/umzug 2.2.3 version and it works

Was this page helpful?
0 / 5 - 0 ratings