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_lee2631 days ago674

reply all(2)I'll reply

  • PHPz

    PHPz2017-04-17 14:38:52

    你的body-parser什么版本?

    reply
    0
  • 天蓬老师

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

    这些中间件都已经在exprss4.0之后connect中分离出来了

    reply
    0
  • Cancelreply