Javascript JS无效/意外令牌:࿽࿽#

Javascript JS无效/意外令牌:࿽࿽#,javascript,node.js,visual-studio-code,syntax-error,Javascript,Node.js,Visual Studio Code,Syntax Error,这是我得到以下错误的第三个节点项目: (function (exports, require, module, __filename, __dirname) { ��# ^ SyntaxError: Invalid or unexpected token at createScript (vm.js:80:10) at Object.runInThisContext (vm.js:

这是我得到以下错误的第三个节点项目:

(function (exports, require, module, __filename, __dirname) { ��#
                                                          ^
SyntaxError: Invalid or unexpected token
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:599:28)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
我还试着对整个文件进行注释,最后放
console.log('hello')但是我仍然得到上面的错误

  • 调用仅为
    节点文件.js
  • 错误发生在
    file.js:1
  • 我使用的是Windows 10计算机
  • 节点v8.9.0
  • npm v5.5.1
  • 编辑:VS代码

我当时正在UTF-16LE中编辑。当我切换到UTF-8时,代码如下所示:

无效令牌可能很棘手,发布整个函数是否要完整文件?因为我不知道它在哪个函数上失败,因为file.js:1不是意味着错误发生在第一行吗?对于这个文件,这将是一个注释。我还可以注释掉整个文件,只需执行
console.log('hello')
并获得相同的错误当然,在这里共享。在您的问题中显示更多代码。编码应为utf8