Ошибка генерации схемы (Nest, n cc, graphql) - PullRequest
1 голос
/ 15 февраля 2020

Я хотел бы использовать n cc, чтобы уменьшить размер моего docker изображения, удалив зависимость от node_modules, но у меня есть проблема во время выполнения:

[Nest] 19257   - 05/08/2019, 10:44 AM   [InstanceLoader] ConfigModule dependencies initialized +18ms
[Nest] 19257   - 05/08/2019, 10:44 AM   [InstanceLoader] ApiModule dependencies initialized +1ms
[Nest] 19257   - 05/08/2019, 10:44 AM   [InstanceLoader] GraphQLModule dependencies initialized +1ms
[Nest] 19257   - 05/08/2019, 10:44 AM   [RoutesResolver] ConfigController {/api/config}: +4ms
[Nest] 19257   - 05/08/2019, 10:44 AM   [RouterExplorer] Mapped {/, GET} route +2ms
(node:19257) UnhandledPromiseRejectionWarning: Error: Generating schema error
    at Function.<anonymous> (/home/**index.js:287962:27)
    at Generator.next (<anonymous>)
    at fulfilled (/home/**/index.js:116122:62)
    at internalTickCallback (internal/process/next_tick.js:77:7)
    at process._tickCallback (internal/process/next_tick.js:47:5)
    at Function.Module.runMain (internal/modules/cjs/loader.js:778:11)
    at startup (internal/bootstrap/node.js:300:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:826:3)
(node:19257) 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(). (rejection id: 1)
(node:19257) [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.

Кажется, что зависимость все еще существует node_modules, потому что он работает с ним ...

У меня тоже есть проблемы с компиляцией, но я не знаю, связано ли это:

➜  start-on-time git:(cleanup-ci-configs) ✗ npx ncc build ./dist/apps/api/main.js -o ./dist/apps/api
ncc: Version 0.18.3
ncc: Compiling file index.js
ncc: Module directory "/home/**/node_modules/chokidar/lib" attempted to require "fsevents" but could not be resolved, assuming external.
ncc: Module directory "/home/**/node_modules/ws/lib" attempted to require "utf-8-validate" but could not be resolved, assuming external.
ncc: Module directory "/home/**/node_modules/ws/lib" attempted to require "bufferutil" but could not be resolved, assuming external.
ncc: Module directory "/home/**/node_modules/@nestjs/core" attempted to require "@nestjs/microservices" but could not be resolved, assuming external.
ncc: Module directory "/home/**/node_modules/@nestjs/core" attempted to require "@nestjs/microservices" but could not be resolved, assuming external.

Версия основных библиотек:

гнездо: 6.1 n cc: 0.18.2 graphql: 14.2 graphql-type: 1.1

...