No visible cause for “Unexpected token ILLEGAL”

后端 未结 11 2240
轻奢々
轻奢々 2020-11-22 00:09

I\'m getting this JavaScript error on my console:

Uncaught SyntaxError: Unexpected token ILLEGAL

This is my code:

11条回答
  •  天涯浪人
    2020-11-22 00:55

    When running OS X, the filesystem creates hidden forks of basically all your files, if they are on a hard drive that doesn't support HFS+. This can sometimes (happened to me just now) lead to your JavaScript engine tries to run the data-fork instead of the code you intend it to run. When this happens, you will also receive

    SyntaxError: Unexpected token ILLEGAL
    

    because the data fork of your file will contain the Unicode U+200B character. Removing the data fork file will make your script run your actual, intended code, instead of a binary data fork of your code.

    .whatever : These files are created on volumes that don't natively support full HFS file characteristics (e.g. ufs volumes, Windows fileshares, etc). When a Mac file is copied to such a volume, its data fork is stored under the file's regular name, and the additional HFS information (resource fork, type & creator codes, etc) is stored in a second file (in AppleDouble format), with a name that starts with ".". (These files are, of course, invisible as far as OS-X is concerned, but not to other OS's; this can sometimes be annoying...)

    • Gordon Davisson @ http://www.westwind.com/reference/OS-X/invisibles.html

提交回复
热议问题