[Solved] nodejs Error: request entity too large

A project written in Vue and nodejs requires image upload, but report error:

PayloadTooLargeError: request entity too large
at readStream

Solution: add Middleware

const bodyParser = require('body-parser');
router.use(bodyParser.urlencoded({extended: false, limit: '10mb'}));

The default is 100kb, which can be replaced by a large number. The unit can be MB, etc

Read More: