【问题标题】:NestJS/Prisma gives "Error Debug Failure" without any additional infoNestJS/Prisma 在没有任何附加信息的情况下给出“错误调试失败”
【发布时间】:2021-06-03 23:34:15
【问题描述】:

运行我的第一个非常小的 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"
  },

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

谢谢,

伯特

【问题讨论】:

    标签: typescript nestjs prisma


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

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

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

      然后它起作用了。

      话虽如此,Jay McDoniel 提供的解决方案显然是真正的解决方案,所以请为 Jay 投上一票。 :-)

      【讨论】:

        【解决方案3】:

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

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

        而不是

          constructor(
                private prisma: PrismaService
              ) { }
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2023-04-06
          • 2020-12-25
          • 1970-01-01
          • 2018-11-15
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多