"Unexpected token"


#1

Hello

Meteor cant run and I get this error:

What it means: “syntax error: unexpected token”

But nothing is wrong!!

Please inform me.

regards
Saeed


#2

You will have to give us more details than this.
We are not magician and we can’t guess what your problem is…


#3

Here comes what I get:

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Users\lingo57>cd meteor

C:\Users\lingo57\Meteor>cd leaderboard6

C:\Users\lingo57\Meteor\leaderboard6>meteor
C:\Users\lingo57\AppData\Local\.meteor\packages\meteor-tool\1.6.1\mt-os.windows.
x86_64\dev_bundle\lib\node_modules\meteor-promise\promise_server.js:218
      throw error;
      ^

SyntaxError: Unexpected token

C:\Users\lingo57\Meteor\leaderboard6>meteor
C:\Users\lingo57\AppData\Local\.meteor\packages\meteor-tool\1.6.1\mt-os.windows.
x86_64\dev_bundle\lib\node_modules\meteor-promise\promise_server.js:218
      throw error;
      ^

SyntaxError: Unexpected token

C:\Users\lingo57\Meteor\leaderboard6>meteor
C:\Users\lingo57\AppData\Local\.meteor\packages\meteor-tool\1.6.1\mt-os.windows.
x86_64\dev_bundle\lib\node_modules\meteor-promise\promise_server.js:218
      throw error;
      ^

SyntaxError: Unexpected token

C:\Users\lingo57\Meteor\leaderboard6>meteor
C:\Users\lingo57\AppData\Local\.meteor\packages\meteor-tool\1.6.1\mt-os.windows.
x86_64\dev_bundle\lib\node_modules\meteor-promise\promise_server.js:218
      throw error;
      ^

SyntaxError: Unexpected token

C:\Users\lingo57\Meteor\leaderboard6>meteor
C:\Users\lingo57\AppData\Local\.meteor\packages\meteor-tool\1.6.1\mt-os.windows.
x86_64\dev_bundle\lib\node_modules\meteor-promise\promise_server.js:218
      throw error;
      ^

SyntaxError: Unexpected token

C:\Users\lingo57\Meteor\leaderboard6>

#4

Is your leaderboard6 cloned from https://github.com/meteor/leaderboard?


#5

yes, that is.You are right.


#6

That project uses Meteor 1.3.4.4, but your log shows it’s building with 1.6.1, which means you must have updated it … what steps did you follow?


#7

I made it with meteor 1.6.1… If things was okay till yesterday and I didn’t have any problem But today face this issue.
here comes my code:

<head>
    <title>Leaderboard</title>
</head>

<body>
    <h1>Leaderboard</h1>
    {{>leaderboard}}
</body>

<template name="leaderboard">
    <ul>
        {{#each player}}
        <li class="player {{selectedClass}}">{{name}}:{{score}}</li>
        {{/each}}
        <input type="button" class="increment" value="Give 5 Points">

    </ul>
</template>
import { Session } from 'meteor/session'
import { Mongo } from 'meteor/mongo'



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


if (Meteor.isClient) {




    Template.leaderboard.helpers({

        'player': function () {
            return PlayersList.find()
        },

        'selectedClass': function () {
            var playerId = this._id;
            var selectedPlayer = Session.get('selectedPlayer');
            if (playerId == selectedPlayer) {
                return "selected"
            }
        }


    });
    Template.leaderboard.events({
        'click.player': function () {

            var playerId = this._id;
            Session.set('selectedPlayer', playerId);


        },


        'click.increment': function () {
            var selectedPlayer = Session.get('selectedPlayer');
            PlayersList.update(selectedPlayer, { score: 5 });
        }


    });

}



.selected{
    background-color: yellow;
}

#8

There are no errors in the code you posted

Is it an issue with your Meteor install? Can you run any other projects?
Have you tried creating a new project and running it before changing the code?


#9

Yes, I can make and run other project.


#10

Maybe try copy pasting the code into a new project, since there are no errors in it

The error must be somewhere else in your project that you haven’t provided yet


#11

If you clone the leaderboard and just run it with meteor, it will work because meteor will ensure the correct build tool will be downloaded and used.

I reiterate my earlier post. This looks like it’s been updated to Meteor 1.6.1. The leaderboard will not build and run if it’s just been updated with meteor update. You will need to add a package.json and dependencies (including @babel/runtime).