简体   繁体   中英

Error: Buffer.write(string, encoding, offset[, length]) is no longer supported

I have started working on expressJs node Js but stuck at a point where the user inserts a data in the form and click on submit then get an error. I search so much about this error but not get a proper answer to resolve my issue. Please help me to out this problem.

500 Error: Buffer.write(string, encoding, offset[, length]) is no longer supported

at Buffer.write (buffer.js:763:11)
at MultipartParser.initWithBoundary (/media/iron/1d6c195f-2350-423c-a3f0-0500c92e580a/website/app/node_modules/connect/node_modules/formidable/lib/multipart_parser.js:61:17)
at IncomingForm._initMultipart (/media/iron/1d6c195f-2350-423c-a3f0-0500c92e580a/website/app/node_modules/connect/node_modules/formidable/lib/incoming_form.js:308:10)
at IncomingForm._parseContentType (/media/iron/1d6c195f-2350-423c-a3f0-0500c92e580a/website/app/node_modules/connect/node_modules/formidable/lib/incoming_form.js:250:12)
at IncomingForm.writeHeaders (/media/iron/1d6c195f-2350-423c-a3f0-0500c92e580a/website/app/node_modules/connect/node_modules/formidable/lib/incoming_form.js:129:8)
at IncomingForm.parse (/media/iron/1d6c195f-2350-423c-a3f0-0500c92e580a/website/app/node_modules/connect/node_modules/formidable/lib/incoming_form.js:97:8)
at /media/iron/1d6c195f-2350-423c-a3f0-0500c92e580a/website/app/node_modules/connect/lib/middleware/multipart.js:125:12
at noop (/media/iron/1d6c195f-2350-423c-a3f0-0500c92e580a/website/app/node_modules/connect/lib/middleware/multipart.js:22:3)
at multipart (/media/iron/1d6c195f-2350-423c-a3f0-0500c92e580a/website/app/node_modules/connect/lib/middleware/multipart.js:76:5)
at /media/iron/1d6c195f-2350-423c-a3f0-0500c92e580a/website/app/node_modules/connect/lib/middleware/bodyParser.js:57:9

Node Version: 6.2.2

Npm Version: 3.9.5

Thanks!!

I was able to resolve this by using npm update command on my express app.

Problem is with bodyParser module, this issue is fixed in latest versions of node. npm update command helped to resolve this issue.

Here is the output after npm update and server restart.

connect deprecated multipart: use parser (multiparty, busboy, formidable) npm module instead at node_modules\\connect\\lib\\middleware\\bodyParser.js:56:20

connect deprecated limit: Restrict request size at location of read at node_modules\\connect\\lib\\middleware\\multipart.js:86:15

connect deprecated methodOverride: use method-override npm module instead at app.js:24:17

Hope this helps to other users facing the same error.

For me it was the issue coming due to the older version of Koa Better Body(koa-better-body) package. I upgraded it from 1.0.17 to 3.3.9 and then it was working fine.

Node Version : 10.19.0

NPM : 6.13.4

Framework : Koa 2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM