http.js:853 throw new TypeError(‘first argument must be a string or Buffer’); ^ TypeError: first argument must be a string or Buffer at ServerResponse.OutgoingMessage.write (http.js:853:11) at IncomingMessage.<anonymous> (D:\nodejs\workspace\express1.js:15:9) at IncomingMessage.EventEmitter.emit (events.js:92:17) at _stream_readable.js:920:16 at process._tickCallback (node.js:415:13) 这个错误都是因为response没有输入相应头信息引起的,增加如下代码可以解决,但不必一样,只要输出响应头信就行; res.writeHead(200,{"Content-Type":"text/html"});
4 回复
at ServerResponse.OutgoingMessage.write (http.js:853:11) 这一行已经说明了 你调用response.write的时候给的第一个参数不是string或者buffer