所以我创建了一个默认的流星应用程序。它运行得很好。现在我在启动函数中添加一个简单的插入。现在它给了我例外。
这是我的 app.js 代码:
Book = new Meteor.Collection("book");
if (Meteor.isClient) {
Template.hello.greeting = function () {
return "Welcome to app_01.";
};
Template.hello.events({
'click input' : function () {
// template data, if any, is available in 'this'
if (typeof console !== 'undefined')
console.log("You pressed the button");
}
});
}
if (Meteor.isServer) {
Meteor.startup(function () {
if (Book.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++)
Book.insert({name: names[i], score: Math.floor(Math.random()*10)*5});
}
});
}
Run Code Online (Sandbox Code Playgroud)
这是我得到的例外:
No dependency info in bundle. Filesystem monitoring disabled.
Errors prevented startup:
Exception while bundling application:
Error: ENOTEMPTY, directory not empty 'C:\Users\Office\Workspace\Code\Meteor\app_01\.meteor\local\build\server'
at Object.fs.rmdirSync (fs.js:456:18)
at Object.module.exports.rm_recursive (C:\Program Files (x86)\Meteor\app\lib\files.js:256:10)
at C:\Program Files (x86)\Meteor\app\lib\files.js:254:15
at Array.forEach (native)
at Function._.each._.forEach (C:\Program Files (x86)\Meteor\lib\node_modules\underscore\underscore.js:79:11)
at Object.module.exports.rm_recursive (C:\Program Files (x86)\Meteor\app\lib\files.js:252:9)
at _.extend.write_to_directory (C:\Program Files (x86)\Meteor\app\lib\bundler.js:493:11)
at Object.exports.bundle (C:\Program Files (x86)\Meteor\app\lib\bundler.js:685:12)
at exports.run.restart_server (C:\Program Files (x86)\Meteor\app\meteor\run.js:615:26)
at C:\Program Files (x86)\Meteor\app\meteor\run.js:726:9
Please fix the problem and restart.
Run Code Online (Sandbox Code Playgroud)
控制台根本没有给我任何有用的信息。
更多信息:我正在使用 Windows 版本的meteor 0.5.4 我的代码有制表符和空格作为缩进(这应该是一个问题吗?)
让我更加困惑的是:如果我运行排行榜示例,它会完美运行。
当我使用修改后的启动代码运行默认项目时,出现异常。>.<
更多信息:当服务器崩溃时,mongod 服务仍在 Windows 中运行。以我无限的智慧,我想我会杀死它,也许尝试重新启动它。
现在我收到一个新错误:
PS C:\Users\Office\Workspace\Code\Meteor\app_01> meteor
[[[[[ C:\Users\Office\Workspace\Code\Meteor\app_01 ]]]]]
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Can't start mongod
MongoDB had an unspecified uncaught exception.
Check to make sure that MongoDB is able to write to its database directory.
Run Code Online (Sandbox Code Playgroud)
编辑:现在删除了 .meteor/local/db 内容。我们现在回到 ENOTEMPTY 错误。
这是因为在捆绑操作期间该目录没有被删除。
因此,当发生这种情况时,请使用 停止服务器ctrl + c。
然后删除目录和目录的内容.meteor\local\db并.meteor\local\builds使用命令再次运行服务器meteor。
这不是一个理想的方式,但它确实有效。
| 归档时间: |
|
| 查看次数: |
13521 次 |
| 最近记录: |