Meteor =>退出代码:8错误

时间:2016-06-23 23:51:57

标签: javascript cordova meteor meteor-helper

有点流星的新手。应用程序运行良好,播种db与dburles:factory直到我运行了适用于iOS和Android的cordova构建和meteor添加平台,并安装了所有先决条件。现在我收到以下错误。我试过流星更新和流星重置,它没有做任何补救。

=> Exited with code: 8
I20160623-16:15:58.340(-7)? 200               
I20160623-16:15:58.341(-7)? 0
I20160623-16:15:58.342(-7)? 0
I20160623-16:15:58.343(-7)? 0
I20160623-16:15:58.344(-7)? 0
I20160623-16:15:58.345(-7)? 0
I20160623-16:15:58.345(-7)? 0
I20160623-16:15:58.346(-7)? 0
I20160623-16:15:58.347(-7)? 0
I20160623-16:15:58.347(-7)? 0
W20160623-16:15:58.395(-7)? (STDERR) 
W20160623-16:15:58.396(-7)? (STDERR) /Users/johndow/.meteor/packages/meteor-tool/.1.3.4.zv5a90++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
W20160623-16:15:58.396(-7)? (STDERR)                        throw(ex);
W20160623-16:15:58.396(-7)? (STDERR)                              ^
W20160623-16:15:58.423(-7)? (STDERR) Error: Factory: There is no factory named builders
W20160623-16:15:58.423(-7)? (STDERR)     at Function.Factory.get (packages/dburles:factory/factory.js:29:11)
W20160623-16:15:58.423(-7)? (STDERR)     at Function.Factory.build (packages/dburles:factory/factory.js:35:27)
W20160623-16:15:58.423(-7)? (STDERR)     at Function.Factory.create (packages/dburles:factory/factory.js:119:23)
W20160623-16:15:58.424(-7)? (STDERR)     at app/server/seeds/builders.js:11:15
W20160623-16:15:58.424(-7)? (STDERR)     at Function._.times (packages/underscore/underscore.js:1093:1)
W20160623-16:15:58.424(-7)? (STDERR)     at [object Object]._.(anonymous function) [as times] (packages/underscore/underscore.js:1149:1)
W20160623-16:15:58.424(-7)? (STDERR)     at app/server/seeds/builders.js:10:12
W20160623-16:15:58.425(-7)? (STDERR)     at /Users/johndow/Projects/jackpot/.meteor/local/build/programs/server/boot.js:304:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.

这是我的javascript文件: 控制器 builders.js

  BuildersController = AppController.extend({
  waitOn: function() {
    return this.subscribe('builders'); 
  },
  data: {
    poo: Builders.find({})
  },
  onAfterAction: function () {
    Meta.setTitle('Builders');
  }
});

BuildersController.events({
  'click [data-action=doSomething]': function (event, template) {
    event.preventDefault();
  }
});

种子 builders.js

Meteor.startup(function() {

  Factory.define('builder', Builders, {
    name: function() { return Fake.sentence(); },
    rating: function() { return _.random(1, 5); }
  });

  if (Builders.find({}).count() < 100) {
    Builders.remove({});
    _(200).times(function(n) {
      Factory.create('builders');
    });

  }

});

出版物 builders.js

Meteor.publishComposite("builders",  function(limit) {
  return {
    find: function() {
      //set default limit
      limit = limit || 30;
      return  Builders.find({},{limit: limit});;
    }
    // ,
    // children: [
    //   {
    //     find: function(item) {
    //       return [];
    //     }
    //   }
    // ]
  }
});

集合

builders.js

Builders = new Mongo.Collection('builders');

Builders.helpers({

});

Builders.before.insert(function (userId, doc) {
  doc.createdAt = moment().toDate();
});

html

<template name="builders">
  <div class="template-builders">
    <div class="page-header">
      <h1>Builders</h1>
    </div>
    <h2>{{ pageTitle }}</h2>
    <ul class="list-group">
      {{#each poo}}
        <li class="list-group-item">{{ name }} <span class="label label-default">{{ rating }}</span></li>
      {{/each}}
    </ul>

  </div>
</template>

3 个答案:

答案 0 :(得分:0)

app/server/seeds/builders.js定义一个名为builder的工厂(单数),但在创建后几行(第11行) strong>使用此工厂的对象,您将其引用为builders(复数)。

这就是错误所说的:

Error: Factory: There is no factory named builders

答案 1 :(得分:0)

在终端或powershell中运行以下行:meteor add dburles:factory

答案 2 :(得分:0)

以防万一,您可能想尝试使用Factory.define(...代替Factory.create(

更多信息:https://atmospherejs.com/dburles/factory