即使在我成功升级到最新的流星之后,我仍然会收到此错误。有人可以帮忙吗?
W20141002-17:08:01.669(-5)? (STDERR)
W20141002-17:08:01.841(-5)? (STDERR) /Users/erikbigelow/.meteor/packages/meteor-tool/.1.0.33.kundj5++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141002-17:08:01.842(-5)? (STDERR) throw(ex);
W20141002-17:08:01.842(-5)? (STDERR) ^
W20141002-17:08:01.843(-5)? (STDERR) TypeError: Object #<Object> has no method 'subscribe'
W20141002-17:08:01.843(-5)? (STDERR) at app/main.js:1:43
W20141002-17:08:01.843(-5)? (STDERR) at app/main.js:3:3
W20141002-17:08:01.844(-5)? (STDERR) at /Users/erikbigelow/Sites/scenewith/.meteor/local/build/programs/server/boot.js:168:10
W20141002-17:08:01.844(-5)? (STDERR) at Array.forEach (native)
W20141002-17:08:01.845(-5)? (STDERR) at Function._.each._.forEach (/Users/erikbigelow/.meteor/packages/meteor-tool/.1.0.33.kundj5++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20141002-17:08:01.845(-5)? (STDERR) at /Users/erikbigelow/Sites/scenewith/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
这是在我删除自动发布后直接添加以下内容
服务器/ publications.js:
Meteor.publish('scenes', function() {
return Scenes.find();
});
main.js
Meteor.subscribe('scenes');
集合/ scenes.js
Scenes = new Meteor.Collection('scenes');
答案 0 :(得分:6)
从日志中看起来您正试图在服务器上调用Meteor.subscribe
,或者至少不只是在客户端上调用。
您的通话需要位于客户端文件夹或Meteor.isClient
块中,因为它是client only method,所以它不会被附加到Meteor对象上服务器。
答案 1 :(得分:2)
我不知道您一直在使用的流星版本,但现在您将集合定义为:
myCollection = new Mongo.Collection('mycollection');