Thinkerer
Thinkerer

Reputation: 1626

Uncaught SyntaxError: Unexpected token M

Does anyone have any idea how to resolve this error?

The google devt tools does not pinpoint the location of the erroneous code which makes it hard to troubleshoot.

Im currently on Meteor and MongoDB. Ive searched for Unexpected tokens, theres A, N, C but M is not common.

What Ive read is it might be a server commenting problem as it adds random letters and non-recognizable scripts.

Any suggestions?

The problem as shown by dev tools

Upvotes: 1

Views: 7549

Answers (2)

rev087
rev087

Reputation: 163

ng-inspector maintainer here (I don't have enough rep to add a comment)

I'm sorry that the extension caused issues for you. For what it's worth, we've since updated it (v0.5.8) to handle exceptions from the postMessage data.

Upvotes: 4

mwarren
mwarren

Reputation: 2469

I've got the exact same problem, and it's happening at line 1472 in ng-inspector.js at JSON.parse(eventData);

The reason is presumably that event.data is holding some kind of setImmediate string (which begins with the letter 'M') - "Meteor._setImmediate.0.5014774943701923.5"

Here are the five lines in ng-inspector.js leading up to the JSON.parse():

window.addEventListener('message', function (event) {

// Ensure the message was sent by this origin
if (event.origin !== window.location.origin) return;

var eventData = event.data;
if (!eventData || typeof eventData !== 'string') return;
eventData = JSON.parse(eventData);

the debugger shows this stuff in the event object:

event = MessageEvent {data: "Meteor._setImmediate.0.5014774943701923.5", origin: "http://localhost:3000", lastEventId: "", source: Window, ports:

ng-inspector.js is an angular extension for Chrome so I guess all we have to do is uninstall it now that we are using Meteor!

Yes, I can confirm that I have uninstalled the Angular inspector from the Chrome extensions and that the problem is solved.

Upvotes: 3

Related Questions