Search code examples
javascriptmeteoriron-router

Unexpected token bug in Iron Router hooks js


I'm pretty new to Meteor and am getting this error:

=> Errors prevented startup:

While building the application:
lib/packages/iron-router/examples/hooks/hooks.js:30:58: Unexpected token ;

=> Your application has errors. Waiting for file change.

It cropped up with the addition of Iron-Router to my app. The error refers to this file, specifically the line that begins ready: promiseToReady:

  this.route('adminPage', {
    path: '/admin',

    // 10. 3rd party API calls that are similar to waitOns:
    waitOn: function() {
      return {
        // this is made up but I do have code conceptually similar to this
        ready: promiseToReady(GoogleApi.call('/foo/bar'));
      }
    }
  });

Solution

  • In Javascript you terminate object params with ,, not with ;.

    Incorrect:

      return {
        ready: promiseToReady(GoogleApi.call('/foo/bar'));
      };
    

    Correct:

      return {
        ready: promiseToReady(GoogleApi.call('/foo/bar')),
      };