NestJS/Prisma 给出 "Error Debug Failure" 没有任何附加信息

NestJS/Prisma gives "Error Debug Failure" without any additional info

运行 我的第一个非常小的 NestJs/PrismaORM 应用程序并启动它,我得到以下信息:

/Users/bert/Project/helloworld-api_> nest start --debug

 Error  Debug Failure.

/Users/bert/Project/helloworld-api_>

(红色背景错误)

在哪里可以找到有关错误消息的更多信息?

我确定这是我的错误,但如果 NestJS 能给我更多信息就好了。

为了完整起见,我的 tsconfig.json 看起来像这样:

{
  "compilerOptions": {
    "module": "commonjs",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "target": "es2017",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true
  }
}

package.json 中的相关部分是:

  "dependencies": {
    "@nestjs/common": "^7.6.13",
    "@nestjs/core": "^7.6.13",
    "@nestjs/platform-express": "^7.6.13",
    "@prisma/client": "^2.18.0",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^6.6.6"
  },
  "devDependencies": {
    "@nestjs/schematics": "^7.2.7",
    "@nestjs/testing": "^7.6.13",
    "@types/express": "^4.17.11",
    "@types/jest": "^26.0.20",
    "@types/node": "^14.14.31",
    "@types/supertest": "^2.0.10",
    "@typescript-eslint/eslint-plugin": "^4.15.2",
    "@typescript-eslint/parser": "^4.15.2",
    "eslint": "^7.20.0",
    "eslint-config-prettier": "^8.1.0",
    "eslint-plugin-prettier": "^3.3.1",
    "jest": "^26.6.3",
    "prettier": "^2.2.1",
    "prisma": "^2.18.0",
    "supertest": "^6.1.3",
    "ts-jest": "^26.5.2",
    "ts-loader": "^8.0.17",
    "ts-node": "^9.1.1",
    "tsconfig-paths": "^3.9.0",
    "typescript": "^4.1.5"
  },

希望你们能帮助我,因为我有点卡在这里。

谢谢,

伯特

我仍然不知道错误的根本原因,but the documented fix 目前是使用 typescript@next 并利用将成为 typescript@4.3.0[ 的一部分的内容=13=]

解决方案是重建项目中与 Prisma 有关的所有内容。 所以:

  • 删除node_modules
  • 从 package.json
  • 中删除 Prisma 和 Prisma-Client
  • npm 安装
  • npm i prisma 和 prisma-client
  • 重建模块、控制器en和服务

然后成功了。

不过话虽如此,Jay McDoniel 提供的解决方案显然是真正的解决方案,所以请为 Jay 点赞。 :-)

我遇到了类似的麻烦,但是上面写的没有帮助。 因此,在我需要使用 PrismaService 的服务中,我将代码更改为

constructor(
    @Inject(PrismaService) private prisma
  ) { }

而不是

  constructor(
        private prisma: PrismaService
      ) { }