nestjsx / crud

NestJs CRUD for RESTful APIs
https://github.com/nestjsx/crud/wiki
MIT License
4.09k stars 539 forks source link

node_modules/@nestjsx/crud-typeorm/lib/typeorm-crud.service.d.ts:3:27 - error TS2307: Cannot find module 'class-transformer/ClassTransformer' or its corresponding type declarations. #658

Closed cnly1987 closed 3 years ago

cnly1987 commented 3 years ago

this is my package.json, class-transformer have installed.


{
  "name": "els-api",
  "version": "0.0.1",
  "description": "",
  "author": "",
  "private": true,
  "license": "UNLICENSED",
  "scripts": {
    "prebuild": "rimraf dist",
    "build": "nest build",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\" \"libs/**/*.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": {
    "@casl/ability": "^5.1.2",
    "@nestjs/common": "^7.6.5",
    "@nestjs/config": "^0.6.1",
    "@nestjs/core": "^7.6.5",
    "@nestjs/jwt": "^7.2.0",
    "@nestjs/passport": "^7.1.5",
    "@nestjs/platform-express": "^7.6.5",
    "@nestjs/swagger": "^4.7.9",
    "@nestjs/typeorm": "^7.1.5",
    "@nestjsx/crud": "^4.6.2",
    "@nestjsx/crud-typeorm": "^4.6.2",
    "@types/bcrypt": "^3.0.0",
    "@types/cookie-parser": "^1.4.2",
    "@types/passport-jwt": "^3.0.3",
    "@types/passport-local": "^1.0.33",
    "bcrypt": "^5.0.0",
    "class-transformer": "^0.3.1",
    "class-validator": "^0.12.2",
    "cookie-parser": "^1.4.5",
    "hbs": "^4.1.1",
    "lodash": "^4.17.20",
    "moment-timezone": "^0.5.32",
    "mysql": "^2.18.1",
    "nest-router": "^1.0.9",
    "passport": "^0.4.1",
    "passport-jwt": "^4.0.0",
    "passport-local": "^1.0.0",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^6.6.3",
    "swagger-ui-express": "^4.1.6",
    "typeorm": "^0.2.29"
  },
  "devDependencies": {
    "@nestjs/cli": "^7.5.1",
    "@nestjs/schematics": "^7.1.3",
    "@nestjs/testing": "^7.5.1",
    "@types/express": "^4.17.9",
    "@types/jest": "^26.0.15",
    "@types/node": "^14.14.6",
    "@types/supertest": "^2.0.10",
    "@typescript-eslint/eslint-plugin": "^4.6.1",
    "@typescript-eslint/parser": "^4.6.1",
    "eslint": "^7.12.1",
    "eslint-config-prettier": "^6.15.0",
    "eslint-plugin-prettier": "^3.1.4",
    "jest": "^26.6.3",
    "prettier": "^2.1.2",
    "supertest": "^6.0.0",
    "ts-jest": "^26.4.3",
    "ts-loader": "^8.0.8",
    "ts-node": "^9.0.0",
    "tsconfig-paths": "^3.9.0",
    "typescript": "^4.0.5"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": ".",
    "testRegex": ".*\\.spec\\.ts$",
    "transform": {
      "^.+\\.(t|j)s$": "ts-jest"
    },
    "collectCoverageFrom": [
      "**/*.(t|j)s"
    ],
    "coverageDirectory": "./coverage",
    "testEnvironment": "node",
    "roots": [
      "<rootDir>/src/"
    ]
  }
}
opunbuds commented 3 years ago

i found this issue also, i fix this by downgrade the "class-transformer" package to 0.3.1, you can remove the "^" mark on your package.json

kevincodecookies commented 3 years ago

"class-transformer" just released a new patch version which brings in breaking changes, that's not that good if you depend on semver like most of us do, I just asked them to be a bit more carefull here : https://github.com/typestack/class-transformer/issues/553

cnly1987 commented 3 years ago

thank you! @opunbuds @kevincodecookies class-transformer" remove the "^" on my package.json, it's work!