最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - VM[number] file causes Uncaught SyntaxError: Unexpected identifier - Stack Overflow

programmeradmin2浏览0评论

I have Uncaught SyntaxError: Unexpected identifier from the file VM3154:1.
The error appears after I login with a Parse user. I try to locate the file in my server and I cannot find this file. This file has only one line of code:

[object Object]

Anybody knows what is this file? What does it do?

There is an increment for the number every time I log in using Parse User function.

My web uses jQuery, AngularJS, Parse and Bootstrap.

I have Uncaught SyntaxError: Unexpected identifier from the file VM3154:1.
The error appears after I login with a Parse user. I try to locate the file in my server and I cannot find this file. This file has only one line of code:

[object Object]

Anybody knows what is this file? What does it do?

There is an increment for the number every time I log in using Parse User function.

My web uses jQuery, AngularJS, Parse and Bootstrap.

Share Improve this question edited Oct 2, 2015 at 11:56 phuwin asked Oct 2, 2015 at 6:03 phuwinphuwin 3,2705 gold badges27 silver badges49 bronze badges 9
  • 1 where do you see this error: in browser console or in your application logs? – Diana R Commented Oct 2, 2015 at 7:09
  • I see this in the browser console. – phuwin Commented Oct 2, 2015 at 8:56
  • 1 can you paste the full console error? – Diana R Commented Oct 2, 2015 at 9:02
  • [DATETIME] Uncaught SyntaxError: Unexpected identifier VM3154:1 – phuwin Commented Oct 2, 2015 at 10:45
  • 1 Without any piece of code, I can only suggest to ment out one by on efiles you have included in this page and see when this error will disappear. – Diana R Commented Oct 2, 2015 at 12:04
 |  Show 4 more ments

1 Answer 1

Reset to default 4

This can occur when a callback function is expected, but the code is returning an object instead. My specific case was a new before the function passed to setTimeout, and I only figured it out thanks to this answer: https://stackoverflow./a/31502293 (Firefox edition: https://stackoverflow./a/20218837)

setTimeout expects the first parameter to be a function

NOTE: Sometimes this error occurs when a missing quote in JSON causes a ma to be treated as part of the preceding string, eg: ['test1,'test2'].

Example.html to reproduce:

<script>
setTimeout(new function() { document.write('test') },0);
</script>

Instead of clicking the VM61:1 (the number auto-increments) link on the right-hand side, click the gray drop-down arrow/icon on the lef-hand side between the error icon and the words Uncaught SyntaxError to show the call stack and click the first link in the list (see screencast below).

This will jump one frame up the callstack and usually highlight the entire line where the error occurred. It will not pinpoint the exact location of the error but review here carefully for anything that could be returning an object when a callback function is expected.

Remove the new and the error goes away!

PS. This error appeared in Internet Explorer 10 (unless it is running in Compatability Mode) as

SCRIPT1007: Expected ']'
example.html, line 1 character 9

And in Firefox 56 as

SyntaxError: missing ] after element list[Learn More]  example.html:2:8
发布评论

评论列表(0)

  1. 暂无评论