小袋鼠和原型错误

时间:2017-07-28 18:29:39

标签: javascript node.js angular typescript wallaby.js

事情是原型未定义,尽管在节点控制台中编写http.IncomingMessage.prototype确实将对象作为输出。任何想法?

var req = Object.create(http.IncomingMessage.prototype)


Uncaught TypeError: Cannot read property 'prototype' of undefined
at http://localhost:62625/____wallaby-bundle.js?1501265946287&wallabyFileId=bundle:219253

1 个答案:

答案 0 :(得分:10)

我认为http.IncomingMessage未定义。

可能发生了http已被覆盖在代码中的某些位置。

var http = require('http');
var req = Object.create(http.IncomingMessage.prototype)

我已经测试了上面的代码并且有效。

相关问题