Meteor => Exited with code: 8 Error

227 views Asked by At

Kinda new to meteor. app was functioning fine and seeding the db with dburles:factory until I ran cordova build and meteor add-platform for iOS and Android, and installed all the prerequisites. Now I'm getting the error below. I tried meteor update and meteor reset and it did nothing to remedy.

=> 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.

Here's my javascript files: Controller 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();
  }
});

seeds 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');
    });

  }

});

publications 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 [];
    //     }
    //   }
    // ]
  }
});

collections

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

There are 3 answers

0
Kalman On

In your app/server/seeds/builders.js you are defining a factory called builder (singular), but a few lines later (line 11) when you are creating an object using this factory, you reference it as builders (plural).

That's what the error is saying:

Error: Factory: There is no factory named builders

0
Arun On

Run following line in your terminal or powershell: meteor add dburles:factory

0
Computer's Guy On

Just in case, you might want to try with Factory.define(... instead of Factory.create(

More info: https://atmospherejs.com/dburles/factory