“以代码8退出";样本流星应用 [英] "Exited with code 8" Sample meteor applications

查看:85
本文介绍了“以代码8退出";样本流星应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am new to Meteor.js and currently working on the "leaderboard" example app. After inserting a line of code:

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

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

I received the error in the app's interface:

您的应用程序崩溃了.这是最新的日志."

"Your app is crashing. Here is the latest log."

你好世界

/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."

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

I re-saved the file, went into the terminal and stopped the server and restarted it and received this:

=> 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有关.我对流星很陌生,感谢您的投入.

My research has indicated that 'Exited with code: 8' is an error often associated with try to change db's. I am very new to meteor and input is appreciated.

推荐答案

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

Make sure that you added the Template helper code inside if(Meteor.isClient){} block. If you added the coded in a common area it will try to run the code in the server side also and obviously Template is not available in server side.

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

这篇关于“以代码8退出";样本流星应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆