Windows 为什么我会犯一个诱人的错误?

Windows 为什么我会犯一个诱人的错误?,windows,meteor,Windows,Meteor,所以我创建了一个默认的meteor应用程序。 它跑得很好。 现在我在startup函数中添加了一个简单的insert。 它现在给了我例外 以下是我的app.js代码: Book = new Meteor.Collection("book"); if (Meteor.isClient) { Template.hello.greeting = function () { return "Welcome to app_01."; }; Template.hello.events

所以我创建了一个默认的meteor应用程序。 它跑得很好。 现在我在startup函数中添加了一个简单的insert。 它现在给了我例外

以下是我的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});
    }
  });
}
控制台根本没有给我任何有用的信息

更多信息: 我使用的是windows版本的meteor 0.5.4 我的代码同时有制表符和空格作为缩进(这会有问题吗?)


使我更加困惑的是: 如果我运行排行榜示例,它运行得非常完美


当我用修改过的启动代码运行默认项目时,我得到了异常 刚刚在我的mac和Windows机器上测试过,它对我来说很好。(将您的代码复制并粘贴到app.js中,在其他任何地方都没有更改,因为我知道这就是您所做的)

有两种方法可以继续:

  • 您可以尝试流星重置警告:这将清空此应用程序中的所有数据库,但我认为目前没有任何重要的内容
  • 您可以删除该应用程序,并使用meteor create appname创建一个新的应用程序,然后将上面的源代码复制到app.js中
  • 我认为投入太多的时间和精力是不值得的,因为它不是一个接近生产阶段的应用程序。但是,如果创建一个新的应用程序会导致同样的问题,那么它将变得有趣=)

    编辑:刚刚四处搜索,发现了以下内容: 向下滚动至答案;显然,这可能是你的防病毒扫描阻止流星重建它。可能吗?
    另外,您是否从cmd.exe以外的任何地方启动Meteor?我刚刚通读了GitHub上的问题,当使用cmd.exe以外的任何东西(例如GitHub Bash Shell)时,事情似乎非常棘手,这是因为在绑定操作期间没有删除目录

    因此,发生这种情况时,请使用
    ctrl+c
    停止服务器

    然后删除
    .meteor\local\db
    目录以及
    .meteor\local\builds
    目录的内容,并使用
    meteor
    命令再次运行服务器


    这不是一种理想的方法,但它很有效。

    一旦我的请求进入,这个问题应该得到解决:


    没有。现在我回到第一个错误:正在运行:捆绑包中没有依赖项信息。文件系统监视已禁用。错误阻止启动:绑定应用程序时出现异常:错误:ENOTEMPTY,目录不为空该目录中没有自定义内容。这是使用meteor create app创建的默认meteor项目。我只是在启动代码中添加了排行榜插入语句。我读的是完全相同的问题。我刚刚在这里添加了我的评论:
    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.
    
    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.