繁体   English   中英

“代码8退出”流星应用示例

[英]“Exited with code 8” Sample meteor applications

我是Meteor.js的新手,目前正在研究"leaderboard"示例应用程序。 插入一行代码后:

Template.leaderboard.player = function(){
  return "Some other text"
}

我在应用程序界面中收到错误:

“您的应用程序崩溃了。这是最新的日志。”

你好,世界

/home/tomas/.meteor/packages/meteor-tool/.1.0.35.hgbesu++os.linux.x86_32+web.browser+web.cordova/meteor-tool-os.linux.x86_32/dev_bundle/lib/node_modules/fibers/future.js:173
                        throw(ex);
                              ^
ReferenceError: Template is not defined
    at app/leaderboard.js:13:1
    at app/leaderboard.js:17:3
    at /home/tomas/leaderboard/.meteor/local/build/programs/server/boot.js:168:10
    at Array.forEach (native)
    at Function._.each._.forEach (/home/tomas/.meteor/packages/meteor-tool/.1.0.35.hgbesu++os.linux.x86_32+web.browser+web.cordova/meteor-tool-os.linux.x86_32/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
    at /home/tomas/leaderboard/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change."

我重新保存了文件,进入终端并停止了服务器,然后重新启动它并收到以下消息:

=> Exited with code: 8
I20141122-11:01:32.695(-5)? Hello world       
W20141122-11:01:32.697(-5)? (STDERR) 
W20141122-11:01:32.699(-5)? (STDERR) /home/tomas/.meteor/packages/meteor-tool/.1.0.35.hgbesu++os.linux.x86_32+web.browser+web.cordova/meteor-tool-os.linux.x86_32/dev_bundle/lib/node_modules/fibers/future.js:173
W20141122-11:01:32.701(-5)? (STDERR)                        throw(ex);
W20141122-11:01:32.702(-5)? (STDERR)                              ^
W20141122-11:01:32.708(-5)? (STDERR) ReferenceError: Template is not defined
W20141122-11:01:32.709(-5)? (STDERR)     at app/leaderboard.js:13:1
W20141122-11:01:32.710(-5)? (STDERR)     at app/leaderboard.js:17:3
W20141122-11:01:32.710(-5)? (STDERR)     at /home/tomas/leaderboard/.meteor/local/build/programs/server/boot.js:168:10
W20141122-11:01:32.711(-5)? (STDERR)     at Array.forEach (native)
W20141122-11:01:32.712(-5)? (STDERR)     at Function._.each._.forEach (/home/tomas/.meteor/packages/meteor-tool/.1.0.35.hgbesu++os.linux.x86_32+web.browser+web.cordova/meteor-tool-os.linux.x86_32/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20141122-11:01:32.712(-5)? (STDERR)     at /home/tomas/leaderboard/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.

我的研究表明, 'Exited with code: 8'是一个错误,通常与尝试更改db有关。 我对流星很陌生,感谢您的投入。

确保已在if(Meteor.isClient){}块内添加了Template帮助程序代码。 如果您在公共区域中添加了代码,它将尝试在服务器端也运行代码,并且显然Template在服务器端不可用。

if (Meteor.isClient) {
  Template.leaderboard.helpers({
    players: function () {
      return "Some other text"
  }
});

在我的情况下,错误代码相同,即8,但是堆栈跟踪不同。 这是我的堆栈跟踪。

W20150821-20:23:59.161(5.5)? (STDERR) Error: A method named '/players/insert' is already defined
W20150821-20:23:59.161(5.5)? (STDERR)     at packages/ddp/livedata_server.js:1461:1
W20150821-20:23:59.161(5.5)? (STDERR)     at Function._.each._.forEach (packages/underscore/underscore.js:113:1)
W20150821-20:23:59.161(5.5)? (STDERR)     at [object Object]._.extend.methods (packages/ddp/livedata_server.js:1459:1)
W20150821-20:23:59.161(5.5)? (STDERR)     at [object Object].Mongo.Collection._defineMutationMethods (packages/mongo/collection.js:904:1)
W20150821-20:23:59.161(5.5)? (STDERR)     at new Mongo.Collection (packages/mongo/collection.js:209:1)
W20150821-20:23:59.162(5.5)? (STDERR)     at app/leadboard.js:45:15

我正在做某事。 然后,我确实备份了文件并将其保存在同一文件夹中。 由于以下语句

CollectionName = new Mongo.Collection('collection-name')

在整个项目中出现了两次。 这就是为什么我得到此错误。 我删除了备份文件,一切都整理好了。 希望以后能对某人有所帮助。

我同样收到了同样的错误!

我有代码行

PlayersList = new Mongo.Collection('players');

在我的客户文档和服务器文档中。

看来此错误是由于重复或在正确的位置没有集合声明而发生的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM