TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be one of type string or Buffer.
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
对象字符串化。
还没有评论,来说两句吧...