nestjs / docs.nestjs.com

The official documentation https://docs.nestjs.com 📕
MIT License
1.19k stars 1.71k forks source link

Sample gRPC for Nest V5 isn't working #71

Closed coderdiaz closed 6 years ago

coderdiaz commented 6 years ago

The sample for use the new gRPC Microservice isn't working.

Sample: https://github.com/nestjs/nest/tree/master/sample/04-grpc

Error:

yarn start
yarn run v1.5.1
$ ts-node src/main.ts

/Users/javierdiaz/coderdiaz/github/nestjs-grpc/node_modules/ts-node/src/index.ts:330
        throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset))
              ^
TSError: ⨯ Unable to compile TypeScript
src/hero/hero.controller.ts (20,11): Argument of type '{ transport: Transport; options: { package: string; protoPath: string; }; }' is not assignable to parameter of type 'ClientOptions'.
  Type '{ transport: Transport; options: { package: string; protoPath: string; }; }' is not assignable to type 'TcpClientOptions'.
    Types of property 'transport' are incompatible.
      Type 'Transport' is not assignable to type 'Transport.TCP'. (2345)
    at getOutput (/Users/javierdiaz/coderdiaz/github/nestjs-grpc/node_modules/ts-node/src/index.ts:330:15)
    at Object.compile (/Users/javierdiaz/coderdiaz/github/nestjs-grpc/node_modules/ts-node/src/index.ts:516:11)
    at Module.m._compile (/Users/javierdiaz/coderdiaz/github/nestjs-grpc/node_modules/ts-node/src/index.ts:403:43)
    at Module._extensions..js (module.js:584:10)
    at Object.require.extensions.(anonymous function) [as .ts] (/Users/javierdiaz/coderdiaz/github/nestjs-grpc/node_modules/ts-node/src/index.ts:406:12)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
error An unexpected error occurred: "Command failed.
Exit code: 1
Command: sh
Arguments: -c ts-node src/main.ts
Directory: /Users/javierdiaz/coderdiaz/github/nestjs-grpc
Output:
".
info If you think this is a bug, please open a bug report with the information provided in "/Users/javierdiaz/coderdiaz/github/nestjs-grpc/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Nest: v5.0.0-beta.6 and v5.0.0-rc.2 Yarn: v1.5.1 Platform: Mac

The sample is outdated? Thanks :)

kamilmysliwiec commented 6 years ago

Fixed 🙂 Take a look now

coderdiaz commented 6 years ago

Cool :) Thanks man