当我运行以下代码时:
var os = require('os');
var sys= require('sys');
var ostype = os.type() + " ";
sys.puts(ostype.prototype.toString());
sys.puts("\n");
我收到以下错误:
node.js:116
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Cannot call method 'toString' of undefined
at Object.<anonymous> (/home/Maria Dillon/test.js:5:27)
at Module._compile (module.js:374:26)
at Object..js (module.js:380:10)
at Module.load (module.js:306:31)
at Function._load (module.js:272:10)
at Array.<anonymous> (module.js:393:10)
at EventEmitter._tickCallback (node.js:108:26)
如果我理解ECMA-262第3版的15.2.4.2,这应该有用。
PS我正在运行node.js 0.5.0pre,我是在Cygwin上自行构建的。