Thomas Johnson
Thomas Johnson

Reputation: 51

"Exited with code 8" Sample meteor applications

I am new to Meteor.js and currently working on the "leaderboard" example app. After inserting a line of code:

Template.leaderboard.player = function(){
  return "Some other text"
}

I received the error in the app's interface:

"Your app is crashing. Here is the latest log."

Hello world

/home/tomas/.meteor/packages/meteor-tool/.1.0.35.hgbesu++os.linux.x86_32+web.browser+web.cordova/meteor-tool-os.linux.x86_32/dev_bundle/lib/node_modules/fibers/future.js:173
                        throw(ex);
                              ^
ReferenceError: Template is not defined
    at app/leaderboard.js:13:1
    at app/leaderboard.js:17:3
    at /home/tomas/leaderboard/.meteor/local/build/programs/server/boot.js:168:10
    at Array.forEach (native)
    at Function._.each._.forEach (/home/tomas/.meteor/packages/meteor-tool/.1.0.35.hgbesu++os.linux.x86_32+web.browser+web.cordova/meteor-tool-os.linux.x86_32/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
    at /home/tomas/leaderboard/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change."

I re-saved the file, went into the terminal and stopped the server and restarted it and received this:

=> Exited with code: 8
I20141122-11:01:32.695(-5)? Hello world       
W20141122-11:01:32.697(-5)? (STDERR) 
W20141122-11:01:32.699(-5)? (STDERR) /home/tomas/.meteor/packages/meteor-tool/.1.0.35.hgbesu++os.linux.x86_32+web.browser+web.cordova/meteor-tool-os.linux.x86_32/dev_bundle/lib/node_modules/fibers/future.js:173
W20141122-11:01:32.701(-5)? (STDERR)                        throw(ex);
W20141122-11:01:32.702(-5)? (STDERR)                              ^
W20141122-11:01:32.708(-5)? (STDERR) ReferenceError: Template is not defined
W20141122-11:01:32.709(-5)? (STDERR)     at app/leaderboard.js:13:1
W20141122-11:01:32.710(-5)? (STDERR)     at app/leaderboard.js:17:3
W20141122-11:01:32.710(-5)? (STDERR)     at /home/tomas/leaderboard/.meteor/local/build/programs/server/boot.js:168:10
W20141122-11:01:32.711(-5)? (STDERR)     at Array.forEach (native)
W20141122-11:01:32.712(-5)? (STDERR)     at Function._.each._.forEach (/home/tomas/.meteor/packages/meteor-tool/.1.0.35.hgbesu++os.linux.x86_32+web.browser+web.cordova/meteor-tool-os.linux.x86_32/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20141122-11:01:32.712(-5)? (STDERR)     at /home/tomas/leaderboard/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.

My research has indicated that 'Exited with code: 8' is an error often associated with try to change db's. I am very new to meteor and input is appreciated.

Upvotes: 1

Views: 7317

Answers (3)

Brenda Zanze
Brenda Zanze

Reputation: 1

I similarly received the same error!

I had the line of code

PlayersList = new Mongo.Collection('players');

in both my client document and server document.

It looks like this error happens due to repetition or not having collection declarations in the right place.

Upvotes: 0

Tyagi Akhilesh
Tyagi Akhilesh

Reputation: 860

In my case the error code was same i.e. 8 but the stack trace was different. This was my stack trace.

W20150821-20:23:59.161(5.5)? (STDERR) Error: A method named '/players/insert' is already defined
W20150821-20:23:59.161(5.5)? (STDERR)     at packages/ddp/livedata_server.js:1461:1
W20150821-20:23:59.161(5.5)? (STDERR)     at Function._.each._.forEach (packages/underscore/underscore.js:113:1)
W20150821-20:23:59.161(5.5)? (STDERR)     at [object Object]._.extend.methods (packages/ddp/livedata_server.js:1459:1)
W20150821-20:23:59.161(5.5)? (STDERR)     at [object Object].Mongo.Collection._defineMutationMethods (packages/mongo/collection.js:904:1)
W20150821-20:23:59.161(5.5)? (STDERR)     at new Mongo.Collection (packages/mongo/collection.js:209:1)
W20150821-20:23:59.162(5.5)? (STDERR)     at app/leadboard.js:45:15

I was working on something. And then I did take the backup of my files and kept it in same folder. Due to which the statement like below

CollectionName = new Mongo.Collection('collection-name')

was appearing twice in the whole project. That is why I was getting this error. I removed my backup files and things got sorted out. Hope it helps someone in future.

Upvotes: 0

Rajanand02
Rajanand02

Reputation: 1303

Make sure that you added the Template helper code inside if(Meteor.isClient){} block. If you added the coded in a common area it will try to run the code in the server side also and obviously Template is not available in server side.

if (Meteor.isClient) {
  Template.leaderboard.helpers({
    players: function () {
      return "Some other text"
  }
});

Upvotes: 1

Related Questions