我正在嘗試使用Node.js與IBM Watson對話服務。 我用「表達」發佈一則消息:拋出新的RangeError節點js
app.post('/api/message', function(req, res) {
}
和打印的郵件從服務了:
conversation.message(payload, function(err, data) {
if (err) {
return res.status(err.code || 500).json(err);
}
return res.json(updateMessage(payload, data));
});
我只是跑在端口3000的應用程序,同時該頁面未裝載我得到這個錯誤:
_http_server.js:192
throw new RangeError(`Invalid status code: ${statusCode}`);
^
RangeError: Invalid status code: 0
at ServerResponse.writeHead (_http_server.js:192:11)
at ServerResponse._implicitHeader (_http_server.js:157:8)
at ServerResponse.OutgoingMessage.end (_http_outgoing.js:573:10)
at ServerResponse.send (C:\IBM\1.Mission\2016\conversation-simple-master(1)\
conversation-simple-master\node_modules\express\lib\response.js:204:10)
at ServerResponse.json (C:\IBM\1.Mission\2016\conversation-simple-master(1)\
conversation-simple-master\node_modules\express\lib\response.js:249:15)
at C:\IBM\1.Mission\2016\conversation-simple-master(1)\conversation-simple-m
aster\app.js:86:44
at Request._callback (C:\IBM\1.Mission\2016\conversation-simple-master(1)\co
nversation-simple-master\node_modules\watson-developer-cloud\lib\requestwrapper.
js:47:7)
at self.callback (C:\IBM\1.Mission\2016\conversation-simple-master(1)\conver
sation-simple-master\node_modules\watson-developer-cloud\node_modules\request\re
quest.js:200:22)
at emitOne (events.js:77:13)
at Request.emit (events.js:169:7)
我不認爲這個問題是來自NPM,回到我的包......雖然它似乎是一個普遍問題...感謝您的幫助。
你寫了什麼代碼?在app.js中的一個?你應該向我們展示它更容易的幫助。 –
@羅蘭,我剛剛編輯了我的問題。我認爲這是npm的標準問題,我無法從服務中獲得帖子... –