Syntaxerror: Invalid Or Unexpected Token At Createscript (vm.js:80:10)
Solution 1:
It looks like there is some encoding
issue with the file that you're trying to run with Node
. Sometimes, files created with some command line utility does some encoding issues with the file. So, I would suggest not to use them to create file. Just create file with Right-Click > New File > app.js
and replace your old file with this app.js
. And try running node app.js
.
Solution 2:
I had a similar issue. My problem was that I copy-pasted code from a website and the '"' were wrongly formatted by my editor. So, I replaced all those quotations with " or ', whichever is applicable.
That solved my issue.
Solution 3:
I faced smilier issue.
SyntaxError: Invalid or unexpected token
at createScript(vm.js:80:10)
But in my case, i was using nvm and forgot to switch the node version to latest version. After switching to latest version it works and did not get this exception
Solution 4:
I got this same error when trying to run a program I compiled as an executable. Instead of just running ./program
I was trying to run it with node. So I did node ./program
.
Trying to run the executable (compiled with pkg for linux) with node gave me pretty much the exact same error you got here.
Solution 5:
I also had the same issue. And indeed it was an encoding problem. Our js file was parsing another file which had been copied/pasted from a pdf. Turned out there was a corrupted space character in the middle of the file.
Removing it solved my issue.
Post a Comment for "Syntaxerror: Invalid Or Unexpected Token At Createscript (vm.js:80:10)"