財產 '原型' app.jsutil.inherits引發TypeError:無法讀取的不確定
var Website = new require('./jslib/website.js');
./jslib/website.js
var util = require('util'),
events = require('events');
module.exports = Website;
function Website()
{
events.EventEmitter.call(this);
return this;
}
util.inherits(Website, events.EventEmiter);
控制檯輸出
PATH_TO_APPDIR>node app.js
util.js:538
ctor.prototype = Object.create(superCtor.prototype, {
^
TypeError: Cannot read property 'prototype' of undefined
at Object.exports.inherits (util.js:538:43)
at Object.<anonymous> (PATH_TO_APPDIR\jslib\website.js:9:6)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at new require (module.js:378:17)
at Object.<anonymous> (PATH_TO_APPDIR\app.js:1:16)
at Module._compile (module.js:449:26)
這是Windows 7上的NodeJS 8.22 *
感謝您的提醒 – HyderA 2015-11-08 05:57:24