Docker force构建未解决“类转换器”包丢失错误

nnsrf1az  于 2023-02-11  发布在  Docker
关注(0)|答案(1)|浏览(137)

class-transformer安装到项目中并运行docker compose --build -V后,不解决此错误:

[Nest] 48  - 12/01/2022, 7:39:07 AM   ERROR [PackageLoader] The "class-transformer" package is missing. Please, make sure to install this library ($ npm install class-transformer) to take advantage of ValidationPipe.
hestia-mongodb-arbit

我该如何解决这个问题?
package.json

{
  "name": "app",
  "version": "0.0.1",
  "description": "",
  "author": "",
  "private": true,
  "license": "UNLICENSED",
  "scripts": {
    "prebuild": "rimraf dist",
    "build": "nest build",
    "format": "prettier --write \"apps/**/*.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 ./apps/app/test/jest-e2e.json"
  },
  "dependencies": {
    "@nestjs/common": "^9.2.1",
    "@nestjs/config": "^2.2.0",
    "@nestjs/core": "^9.2.1",
    "@nestjs/graphql": "^10.1.6",
    "@nestjs/microservices": "^9.2.1",
    "@nestjs/mongoose": "^9.2.1",
    "@nestjs/platform-express": "^9.2.1",
    "class-transformer": "^0.5.1",
    "class-validator": "^0.13.2",
    "cookie-parser": "^1.4.6",
    "graphql": "^16.6.0",
    "install": "^0.13.0",
    "joi": "^17.7.0",
    "mongodb": "^4.12.1",
    "mongoose": "^6.7.4",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^7.5.7"
  },
  "devDependencies": {
    "@nestjs/cli": "^9.1.5",
    "@nestjs/schematics": "^9.0.3",
    "@nestjs/testing": "^9.2.1",
    "@types/express": "^4.17.14",
    "@types/jest": "28.1.8",
    "@types/node": "^16.18.3",
    "@types/supertest": "^2.0.12",
    "@typescript-eslint/eslint-plugin": "^5.45.0",
    "@typescript-eslint/parser": "^5.45.0",
    "eslint": "^8.28.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-prettier": "^4.2.1",
    "jest": "28.1.3",
    "prettier": "^2.8.0",
    "source-map-support": "^0.5.21",
    "supertest": "^6.3.1",
    "ts-jest": "28.0.8",
    "ts-loader": "^9.4.1",
    "ts-node": "^10.9.1",
    "tsconfig-paths": "4.1.0",
    "typescript": "^4.9.3"
  },
  "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>/apps/",
      "<rootDir>/libs/"
    ],
    "moduleNameMapper": {
      "^@app/common(|/.*)$": "<rootDir>/libs/common/src/$1"
    }
  }
}
mitkmikd

mitkmikd1#

删除所有的图像和容器,然后重新构建,这在我的情况下有效。希望它能解决你的问题。

相关问题