I\'m getting this JavaScript error on my console:
Uncaught SyntaxError: Unexpected token ILLEGAL
This is my code:
I had the same problem on my mac and found it was because the Mac was replacing the standard quotes with curly quotes which are illegal javascript characters.
To fix this I had to change the settings on my mac System Preferences=>Keyboard=>Text(tab) uncheck use smart quotes and dashes (default was checked).
If you are running a nginx + uwsgi setup vagrant then the main problem is the Virtual box bug with send file as mentioned in some of the answers. However to resolve it you have to disable sendfile in both nginx and uwsgi.
In nginx.conf sendfile off
uwsgi application / config --disable-sendfile
This also could be happening if you're copying code from another document (like a PDF) into your console and trying to run it.
I was trying to run some example code out of a Javascript book I'm reading and was surprised it didn't run in the console.
Apparently, copying from the PDF introduces some unexpected, illegal, and invisible characters into the code.
I had this same problem and it occurred because I had hit the enter key when adding code in a text string.
Because it was a long string of text I wanted to see it all without having to scroll in my text editor, however hitting enter added an invisible character to the string which was illegal. I was using Sublime Text as my editor.
why you looking for this problem into your code? Even, if it's copypasted.
If you can see, what exactly happening after save file in synced folder - you will see something like *****
at the end of file. It's not related to your code at all.
Solution.
If you are using nginx
in vagrant box - add to server config:
sendfile off;
If you are using apache
in vagrant box - add to server config:
EnableSendfile Off;
Source of problem: VirtualBox Bug