nestjs學習之notadd研究--運行notadd

環境說明

node 12.8.1

npm 6.10.2

yarn 1.21.1

node-gyp 5.0.7

windows-build-tools , vs2017


1、從github中下載 notadd

2、yarn install

安裝時出現一些錯誤,無法編譯通過報rxjs-grpc編譯錯誤,將之引用的版本改為:0.2.5,然後再安裝,出現下載錯誤,翻牆後在將C:\\Users\\Administrator下的.yarnrc文件中的taobao鏡像去掉,然後再安裝就成功。


nestjs學習之notadd研究--運行notadd

nestjs學習之notadd研究--運行notadd

3、在運行yarn start之前先運行 nt-module-user,nt-rpc-demo

運行 nt-module-user 參見:

https://mp.toutiao.com/profile_v3/graphic/preview?pgc_id=6810667315072336388


4、運行yarn start,出現如下錯誤

TSError: ⨯ Unable to compile TypeScript:

src/common/interceptors/errors.interceptor.ts:7:5 - error TS2416: Property 'intercept' in type 'ErrorsInterceptor' is not assignable to the same property in base type 'NestInterceptor'.

Type '(context: ExecutionContext, calls$: Observable) => Observable' is not assignable to type '(context: ExecutionContext, next: CallHandler) => Observable | Promise<observable>>'./<observable>

Types of parameters 'calls$' and 'next' are incompatible.

修改如下文件

nestjs學習之notadd研究--運行notadd

再次運行 yarn start,報如下錯誤

src/graphql-config.service.ts:16:26 - error TS2322: Type 'typeof import("F:/MyWork/998Study/nestjs/nodadd/notadd/node_modules/@types/graphql-type-json/index")' is not assignable to type '(() => any) | GraphQLScalarType | IEnumResolver | IResolverObject | IResolverOptions'.

Type 'typeof import("F:/MyWork/998Study/nestjs/nodadd/notadd/node_modules/@types/graphql-type-json/index")' is not assignable to type 'IResolverObject'.

Property 'GraphQLJSONObject' is incompatible with index signature.

Type 'GraphQLScalarType' is not assignable to type 'IResolverObject | IResolverOptions | IFieldResolver'.

Type 'GraphQLScalarType' is not assignable to type 'IResolverObject'.

Index signature is missing in type 'GraphQLScalarType'.

16 resolvers: { JSON: GraphQLJSON },

修改如下文件

package.json中 graphql-type-json 改為0.3.1, @types/graphql-type-json改為0.3.2

graphql-config.service.ts文件如下修改

nestjs學習之notadd研究--運行notadd

再次運行 yarn start,還報如下錯誤

[Nest] 7468 - 2020-04-02 13:45 [PackageLoader] No driver (HTTP) has been selected. In order to take advantage of the default driver, please, ensure to install the "@nestjs/platform-express" package ($ npm install @nestjs/platform-express).

添加@nestjs/platform-express模塊

yarn add @nestjs/platform-express

再次運行 yarn start,還報如下錯誤

(node:4652) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'constructor' of null

at F:\\MyWork\\998Study\\nestjs\\nodadd\\notadd\\src\\modules\\\\user\\\\user.module.ts:67:72

修改user.module.ts,增加null檢查

nestjs學習之notadd研究--運行notadd

再次運行 yarn start,終於成功


分享到:


相關文章: