nestjs / nest

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
https://nestjs.com
MIT License
67.64k stars 7.62k forks source link

Nest can't resolve dependencies of the RoleManagementService (?, XmwRoleRepository, XmwPermissionRepository). Please make sure that the argument Sequelize at index [0] is available in the RoleManagementModule context #10495

Closed baiwumm closed 2 years ago

baiwumm commented 2 years ago

Is there an existing issue for this?

Current behavior

I want to use sequelize transaction,then I do: image image but I dont know how to do in modules : image got An error: image

What should I do Thanks

Minimum reproduction code

https://github.com/Cyan-Xmw/react-umi-xmw/blob/Cyan/Xmw_server/src/modules/system/role-management/role-management.service.ts

Steps to reproduce

No response

Expected behavior

No Error

Package

Other package

No response

NestJS version

9.0.0

Packages versions

{
  "name": "xmw_sequelize",
  "version": "0.0.1",
  "description": "",
  "author": "",
  "private": true,
  "license": "UNLICENSED",
  "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": {
    "@nestjs/common": "^9.0.0",
    "@nestjs/config": "^2.2.0",
    "@nestjs/core": "^9.0.0",
    "@nestjs/platform-express": "^9.0.0",
    "@nestjs/sequelize": "^9.0.0",
    "@nestjs/swagger": "^6.1.2",
    "chalk": "4.1.2",
    "class-transformer": "^0.5.1",
    "class-validator": "^0.13.2",
    "lodash": "^4.17.21",
    "log4js": "^6.7.0",
    "moment": "^2.29.4",
    "mysql2": "^2.3.3",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^7.2.0",
    "sequelize": "^6.25.3",
    "sequelize-typescript": "^2.1.5",
    "stacktrace-js": "^2.0.2",
    "swagger-ui-express": "^4.5.0"
  },
  "devDependencies": {
    "@nestjs/cli": "^9.0.0",
    "@nestjs/schematics": "^9.0.0",
    "@nestjs/testing": "^9.0.0",
    "@types/express": "^4.17.13",
    "@types/jest": "28.1.8",
    "@types/node": "^16.0.0",
    "@types/sequelize": "^4.28.14",
    "@types/supertest": "^2.0.11",
    "@typescript-eslint/eslint-plugin": "^5.0.0",
    "@typescript-eslint/parser": "^5.0.0",
    "eslint": "^8.0.1",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^4.0.0",
    "jest": "28.1.3",
    "prettier": "^2.3.2",
    "source-map-support": "^0.5.20",
    "supertest": "^6.1.3",
    "ts-jest": "28.0.8",
    "ts-loader": "^9.2.3",
    "ts-node": "^10.0.0",
    "tsconfig-paths": "4.1.0",
    "typescript": "^4.7.4"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": "src",
    "testRegex": ".*\\.spec\\.ts$",
    "transform": {
      "^.+\\.(t|j)s$": "ts-jest"
    },
    "collectCoverageFrom": [
      "**/*.(t|j)s"
    ],
    "coverageDirectory": "../coverage",
    "testEnvironment": "node"
  }
}

Node.js version

16.16.0

In which operating systems have you tested?

Other

No response

micalevisk commented 2 years ago

:warning: We use GitHub Issues to track bug reports, feature requests and regressions

Try the following instead:

micalevisk commented 2 years ago

btw, read the docs https://docs.nestjs.com/techniques/database#sequelize-integration

image