1
我無法讓YUI3在節點上工作。如何在節點上使用YUI3?
我已經安裝了根據此站點的所有依賴關係:http://github.com/yui/nodejs-yui3。
這裏是我的代碼:
var jsdom = require("jsdom").jsdom,
window = jsdom("<html><head></head><body>hello world</body></html>").createWindow();
var puts = require("sys").puts;
var YUI = require("yui3").YUI;
var person = {
name: "Ajsie",
age: 25,
greet: function() {
puts("Hello World! My name is " + this.name + " and I am " + this.age + " years old")
}
}
result = YUI.Object(person);
puts(result);
這裏是終端輸出:
node.js:50
throw e;
^
TypeError: Object function() {
var i = 0,
Y = this,
args = arguments,
l = args.length,
gconf = (typeof YUI_config !== 'undefined') && YUI_config;
if (!(Y instanceof YUI)) {
Y = new YUI();
} else {
// set up the core environment
Y._init();
if (gconf) {
Y.applyConfig(gconf);
}
// bind the specified additional modules for this instance
if (!l) {
Y._setup();
}
}
if (l) {
for (; i < l; i++) {
Y.applyConfig(args[i]);
}
Y._setup();
}
return Y;
} has no method 'Object'
at Object.<anonymous> (/Volumes/Private/ajsie/Projects/icdev/javascript/node/object.js:15:14)
at Module._compile (node.js:324:23)
at Object..js (node.js:332:12)
at Module.load (node.js:254:25)
at Object.runMain (node.js:346:24)
at Array.<anonymous> (node.js:595:12)
at EventEmitter._tickCallback (node.js:42:22)
at node.js:607:9
它說:「沒有辦法 「對象」
什麼問題
?