node.js SyntaxError: Invalid or unexpected token

后端 未结 2 1845
囚心锁ツ
囚心锁ツ 2021-01-19 22:13

I have downloaded and installed node.js from https://nodejs.org/en/. I want to run a js file:

console.log(\'hello\');

I run nod

相关标签:
2条回答
  • 2021-01-19 22:31

    The problem was that I created the file by redirecting output from echo command in powershell. It had UTF-16 LE encoding, should be UTF-8

    0 讨论(0)
  • 2021-01-19 22:43

    Did you copy some unicode characters from word or something?

    try retyping the console.log('hello') Something like this has happened to me before, when I copied some code from a word document.

    0 讨论(0)
提交回复
热议问题