Reputation: 3268
I'm developing a pretty simple bot in Node.js, and it won't launch anymore. Node.js is indicating an unexpected token error, but the line number listed is past the end of the file. Specifically, the error is:
C:\Users\Owner\Bot\jovial_bot.js:294
});
^
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
SyntaxError: Unexpected token )
at Module._compile (module.js:427:25)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Array.0 (module.js:470:10)
at EventEmitter._tickCallback (node.js:192:40)
The last line in the program is } );
However, the last line is line number 293. Adding newlines to the end of the file increases the line number reported by Node.js. As far as I can tell, I do not have any unmatch parenthesis. I tried adding ( to the end of the file, and the error changed to "Unexpected token }". Adding " ({ " changed the error to "Unexpected end of input". I don't know where to continue with this. Thank you in advance for the help.
My code is here: http://jsfiddle.net/kunkelwe/VEBtH/ And I'm using this API: https://github.com/alaingilbert/Turntable-API/blob/master/turntable_data/deregistered.js
Upvotes: 1
Views: 9111
Reputation: 17390
You are missing a }
on line 102
. You open a function called toggle_mode
on line 74
but you never put a closing }
.
...
function toggle_mode( mode ) {
switch( mode ) {
...
}
// ** missing a '}' here **
//Events////////////////////////////////////////////////////////////////////////////////////////
bot.on( 'ready', function( data ) { //Join the room
bot.roomRegister(ROOMID);
} );
...
Upvotes: 2