我得到了一个错误,而在nestjs项目运行dist文件,请帮助我


(node:8356) UnhandledPromiseRejectionWarning: Error: No type definitions were found with the specified file name patterns: "./**/*.graphql". Please make sure there is at least one file that matches the given patterns.
at GraphQLTypesLoader.<anonymous> (E:NestJSTemplate_Loginteample-api-backend-nestjsbackendnode_modules@nestjsgraphqldistgraphql-types.loader.js:38:23)
at Generator.next (<anonymous>)
at fulfilled (E:NestJSTemplate_Loginteample-api-backend-nestjsbackendnode_modulestslibtslib.js:114:62)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:8356) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async 
function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:8356) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

我遇到了同样的问题。这很可能是由于.graphql文件在构建时被忽略而没有复制到/dist。有趣的是,我之前没有这个,构建看起来很好,直到今天才出现。

我找到了一个由NestJS创建者提出的问题的解决方案:https://github.com/nestjs/graphql/issues/135

https://docs.nestjs.com/cli/monorepo#assets

在nestjs中有assets选项。这是在nestjs中正确的做法。

相关内容

最新更新