【发布时间】:2013-12-11 18:50:46
【问题描述】:
这次我学习了meteor.js :D 我从例子中学习。 我现在使用的示例是排行榜:http://www.meteor.com/examples/leaderboard 从本机示例项目我有这个文件夹结构:
leaderboard
|-.meteor
|-leaderboard.css
|-leaderboard.html
|-leaderboard.js
我现在尝试了解meteor.js 文件夹结构,我尝试移动到这样的状态:
leaderboard
|-.meteor
|-client
|--leaderboard.css
|-leaderboard.html
|-leaderboard.js
|-public
|-server
我没有更改任何代码,只是创建文件夹并移动 之后我启动流星并访问 localhost:3000 但网络没有工作。 帮助我如何解决这个问题,请解释我如何使用私人文件夹:D
谢谢
更新 我尝试按照说明进行操作。 我用领导更新我的服务器文件夹。
Meteor.startup(function () {
if (Players.find().count() === 0) {
var names = ["Ada Lovelace",
"Grace Hopper",
"Marie Curie",
"Carl Friedrich Gauss",
"Nikola Tesla",
"Claude Shannon"];
for (var i = 0; i < names.length; i++)
Players.insert({name: names[i], score: Math.floor(Random.fraction()*10)*5});
}
});
我在/client 中的 leaderboard.js 我也更新了,没有 if(Meteor.isClient)
这是我的错误:
Your app is crashing. Here's the latest log.
W2036-17:49:01.658(7)? (STDERR) D:\Meteor\leaderboard\.meteor\local\build\programs\server\boot.js:195
W2036-17:49:01.661(7)? (STDERR) }).run();
W2036-17:49:01.662(7)? (STDERR) ^
W2036-17:49:01.663(7)? (STDERR) ReferenceError: Players is not defined
W2036-17:49:01.665(7)? (STDERR) at app/server/leadership.js:2:9
W2036-17:49:01.666(7)? (STDERR) at D:\Meteor\leaderboard\.meteor\local\build\programs\server\boot.js:168:61
W2036-17:49:01.668(7)? (STDERR) at Array.forEach (native)
W2036-17:49:01.669(7)? (STDERR) at Function._.each._.forEach (C:\Users\yoza\AppData\Local\.meteor\tools\e42f0b78d3\lib\node_modules\underscore\underscore.js:79:11)
W2036-17:49:01.671(7)? (STDERR) at D:\Meteor\leaderboard\.meteor\local\build\programs\server\boot.js:168:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
【问题讨论】:
标签: javascript meteor