Javascript 如何在节点上使用YUI3?

Javascript 如何在节点上使用YUI3?,javascript,node.js,yui,yui3,Javascript,Node.js,Yui,Yui3,我无法让YUI3在节点上工作 我已根据此网站安装了所有依赖项: 这是我的密码: var jsdom = require("jsdom").jsdom, window = jsdom("<html><head></head><body>hello world</body></html>").createWindow(); var puts = require("sys").puts; var YUI = requi

我无法让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);
var jsdom=require(“jsdom”).jsdom,
window=jsdom(“hello world”).createWindow();
var看跌期权=要求(“系统”)看跌期权;
var YUI=要求(“YUI 3”)。YUI;
个人变量={
姓名:“Ajsie”,
年龄:25岁,
问候:函数(){
puts(“你好,世界!我的名字是“+this.name+”,我是“+this.age+”岁”)
}
}
结果=YUI.对象(人);
放置(结果);
以下是终端上的输出:

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
node.js:50
投掷e;
^
TypeError:对象函数(){
var i=0,
Y=这个,
args=参数,
l=参数长度,
gconf=(YUI_配置的类型!=‘未定义’&&YUI_配置;
如果(!(YUI的Y实例)){
Y=新YUI();
}否则{
//建立核心环境
Y._init();
如果(gconf){
Y.applyConfig(gconf);
}
//为此实例绑定指定的其他模块
如果(!l){
Y._设置();
}
}
如果(l){
对于(;i
它说“没有方法”对象


问题出在哪里?

代码应该如下所示:


var jsdom  = require("jsdom").jsdom,
    window = jsdom("hello world").createWindow();

var puts = require("sys").puts;
var YUI = require("yui3").YUI;


YUI().use(function(Y){
    var person = {
        name: "Ajsie",
        age: 25,
        greet: function() {
            puts("Hello World! My name is " + this.name + " and I am " + this.age + " years old");
        }
    }

    var result = Y.Object(person);
    puts(result);
});