我刚开始使用meteor.js javascript框架入门这本书学习Meteor框架
我按照那里的示例进行操作,现在我在 my.js 文件中有此代码
lists = new Meteor.Collection("Lists");
Session.set("adding_category", false);
if (Meteor.isClient) {
Template.categories.lists = function() {
return lists.find({}, {sort: {Category: 1}});
}
Template.categories.new_cat = function() {
return Session.equals("adding_category", true)
}
Template.categories.events({
'click #btnNewCat': function (e,t) {
Session.set('adding_category',true);
Meteor.flush();
focusText(t.find("#add-category"));
}
})
function focusText(i) {
i.focus();
i.select();
};
}
if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup
});
}
现在我的应用程序崩溃了:
您的应用程序正在崩溃。这是最新的日志。
W2033-10:54:24.755(0)? (STDERR) /vagrant/mySendondMeteroApp/.meteor/local/build/programs/server/boot.js:184 W2033-10:54:24.757(0)? (STDERR) }).run(); W2033-10:54:24.757(0)? (STDERR) ^ W2033-10:54:24.761(0)? (STDERR) ReferenceError: session is not defined W2033-10:54:24.761(0)? (STDERR) at app/mySendondMeteroApp.js:2:1 W2033-10:54:24.762(0)? (STDERR) at app/mySendondMeteroApp.js:33:3 W2033-10:54:24.763(0)? (STDERR) at mains (/vagrant/mySendondMeteroApp/.meteor/local/build/programs/server/boot.js:153:10) W2033-10:54:24.763(0)? (STDERR) at Array.forEach (native) W2033-10:54:24.764(0)? (STDERR) at Function._.each._.forEach (/home/vagrant/.meteor/tools/3cba50c44a/lib/node_modules/underscore/underscore.js:79:11) W2033-10:54:24.765(0)? (STDERR) at /vagrant/mySendondMeteroApp/.meteor/local/build/programs/server/boot.js:80:5
=> Exited with code: 1
=> Your application is crashing. Waiting for file change.