gpt4 book ai didi

javascript - "Exited with code 8" meteor 应用示例

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:54:50 24 4
gpt4 key购买 nike

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

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

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

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

Hello World

/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' 是一个错误,通常与尝试更改数据库有关。我是 meteor 的新手,非常感谢您的意见。

最佳答案

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

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

关于javascript - "Exited with code 8" meteor 应用示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27079682/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com