TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be one of type string or Buffer. 港控/mmm° 2022-01-10 02:21 289阅读 0赞 ## Msg ## `TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be one of type string or Buffer. Received type object` ## 原因: ## Node后端 express框架,代码如下: app.get(path, function(req, resp) { // ... resp.write(somethind); }); 要写回浏览器页面的数据`something`的类型不是`string`或`Buffer`(可能是一个对象)。 转换类型即可: `resp.write(JSON.stringify(something));` 将`something`对象字符串化。
还没有评论,来说两句吧...