Home  >  Q&A  >  body text

node.js body-parser 为什么会报错 bodyParser.raw is not a function?

很简单的一段代码,想要设置raw的entity大小,因为上传图片导致node request entity too large

修改:

app.use(bodyParser.json({limit: "50mb"}));
app.use(bodyParser.raw({limit: "50mb"}));//这里出错了,bodyParser.raw is not a function?
app.use(bodyParser.urlencoded({limit: "50mb", extended: true, parameterLimit:50000}));
ringa_leeringa_lee2761 days ago784

reply all(2)I'll reply

  • PHPz

    PHPz2017-04-17 14:38:52

    What version is yourbody-parser?

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 14:38:52

    These middlewares have been separated from connect after exprss4.0

    reply
    0
  • Cancelreply