meteor.js中的收集错误

时间:2015-01-25 21:53:06

标签: meteor

我正在从书中Your First Application学习流星,而我却坚持 4.2创建一个集合。当我刷新我的网页时,这就出现了:

Your app is crashing. Here's the latest log.
Hello world!
/home/krtolica/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:173
                        throw(ex);
                              ^
Error: A method named '/players/insert' is already defined
    at packages/ddp/livedata_server.js:1444:1
    at Function._.each._.forEach (packages/underscore/underscore.js:113:1)
    at [object Object]._.extend.methods (packages/ddp/livedata_server.js:1442:1)
    at [object Object].Mongo.Collection._defineMutationMethods (packages/mongo/collection.js:886:1)
    at new Mongo.Collection (packages/mongo/collection.js:208:1)
    at app/leaderboard.js:3:15
    at app/leaderboard.js:13:3
    at /home/krtolica/Meteor/leaderboard/.meteor/local/build/programs/server/boot.js:205:10
    at Array.forEach (native)
    at Function._.each._.forEach (/home/krtolica/.meteor/packages/meteor-tool/.1.0.40.1ef5dzv++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/server-**lib/node_modules/underscore/underscore.js:79:11)
Exited with code: 8
Your application is crashing. Waiting for file change.

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,似乎你需要将 Template.form 定义包含在 Meteor.isClient 中条件,像这样:

if(Meteor.isClient){
    Template.leaderboard.helpers({
    "player": function(){
    return "doesn't work!"
   }
 });
}