如何修复 Atom 编辑器中的“运行 JSHint 包时出错”

问题描述

每次在 Atom 中编辑 JS 文件时,都会出现此错误

[Linter] Error running JSHint

在控制台中看起来像这样:

e[0716/144445.466: ERROR:registration_protocol_win.cc(103)] <embedded>:14
CreateFile: The system cannot find the file specified. (x2)

[0716/144447.414: ERROR:registration_protocol_win.cc(103)] <embedded>:14
CreateFile: The system cannot find the file specified. (0x2)

[0716/145116.108: ERROR:registration_protocol_win.cc(103)] <embedded>:14
CreateFile: The system cannot find the file specified. (x2)

[0716/145122.599: ERROR:registration_protocol_win.cc(103)] <embedded>:14
CreateFile: The system cannot find the file specified. (@x2)

[Linter] Error running JSHint C:\Users\mjwhi\.atom..ter\dist\index.js:1
Error: [0716/145122.942:ERROR:registration_protocol_win.cc(103)]
CreateFile: The system cannot find the file specified. (x2)
at ChildProcess.<anonymous> (C:\Users\mjwhi\.atom\packages\linter-
jshint\node_modules\sb-exec\lib\index.js:56:20)
at ChildProcess.emit (events.js:223:5)
at maybeClose (internal/child process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child process.js:28
3:5)

[0716/145125.805:ERROR:registration_protocol_win.cc(103)] <embedded>:14
CreateFile: The system cannot find the file specified. (@x2)

[0716/145126.827: ERROR:registration protocol_win.cc(103)] <embedded>:14
CreateFile: The system cannot find the file specified. (x2)

[0716/145128.028: ERROR:registration_protocol_win.cc(103)] <embedded>:14
CreateFile: The system cannot find the file specified. (x2)

或者这里的格式更好:

formatted error as seen above

无论我的项目文件夹如何,这都会出现,因此它似乎不是特定于项目的配置问题。卸载并重新安装 JSHint 似乎没有帮助,重新启动 Atom 也没有帮助。禁用包会阻止错误弹出,但显然不是真正的解决方案。我该如何解决这个问题?

解决方法

安装已弃用的 jshint 软件包 (https://atom.io/packages/jshint),然后安装 linter-jshint,然后卸载已弃用的 jshint 软件包。之后,重新启动 Atom。 您可以在此处找到更好的解释:https://github.com/AtomLinter/linter-jshint/issues/377