問題タブ [fastify]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
2 に答える
1684 参照

node.js - 「TypeError: req.pipe is not a function」を取り除く方法 Nestjs と fastify

NestJS/Fastify と typescript でファイルをアップロードしようとしました

これはmain.ts

そしてこれはfile.controller.ts

このアクションにファイルをアップロードした後、コードは次のような例外をスローします

TypeError: req.pipe is not a function at multerMiddleware (D:\R.Khodabakhshi\Repository\raimun-web\node_modules\multer\lib\make-middleware.js:176:9) at Promise (D:\R.Khodabakhshi) \Repository\raimun-web\node_modules@nestjs\platform-express\multer\interceptors\file.interceptor.js:15:81) at new Promise () at MixinInterceptor.intercept (D:\R.Khodabakhshi\Repository\raimun- web\node_modules@nestjs\platform-express\multer\interceptors\file.interceptor.js:15:19) を D:\R.Khodabakhshi\Repository\raimun-web\node_modules@nestjs\core\interceptors\interceptors-consumer に配置します。 js:22:36 で Object.handle (D:\R.Khodabakhshi\Repository\raimun-web\node_modules@nestjs\core\interceptors\interceptors-consumer.js:20:56) で LoggingInterceptor.intercept (D:\R .Khodabakhshi\Repository\raimun-web\dist\shared\logging.interceptor.js:28:21) D:\R.Khodabakhshi\Repository\raimun-web\node_modules@nestjs\core\interceptors\interceptors-consumer.js:22:36 で InterceptorsConsumer.intercept (D:\R.Khodabakhshi\Repository\raimun-web \node_modules@nestjs\core\interceptors\interceptors-consumer.js:24:24) D:\R.Khodabakhshi\Repository\raimun-web\node_modules@nestjs\core\router\router-execution-context.js:45 :60 [Nest] 10928 - 2020-02-06 10:10:49 [ExceptionFilter] undefined undefined +587529ms TypeError: req.pipe is not a function at multerMiddleware (D:\R.Khodabakhshi\Repository\raimun-web\node_modules \multer\lib\make-middleware.js:176:9) Promise (D:\R.Khodabakhshi\Repository\raimun-web\node_modules@nestjs\platform-express\multer\interceptors\file.interceptor.js:15) :81) 新しい Promise () at MixinInterceptor.intercept (D:\R.Khodabakhshi\Repository\raimun-web\node_modules@nestjs\platform-express\multer\interceptors\file.interceptor.js:15:19) at D:\R.Khodabakhshi\Repository\raimun-web\node_modules@nestjs\core\ Interceptors\interceptors-consumer.js:22:36 の Object.handle (D:\R.Khodabakhshi\Repository\raimun-web\node_modules@nestjs\core\interceptors\interceptors-consumer.js:20:56) の LoggingInterceptor。 D:\R.Khodabakhshi\Repository\raimun-web\node_modules@nestjs\core\interceptors でインターセプト (D:\R.Khodabakhshi\Repository\raimun-web\dist\shared\logging.interceptor.js:28:21) \interceptors-consumer.js:22:36 at InterceptorsConsumer.intercept (D:\R.Khodabakhshi\Repository\raimun-web\node_modules@nestjs\core\interceptors\interceptors-consumer.js:24:24) at D:\ R.Khodabakhshi\Repository\raimun-web\node_modules@nestjs\core\router\router-execution-context.js:45:60

どうすれば問題を解決できますか???