SublimeLinter:警告:jshint 已停用,无法找到“jshint”

Posted

技术标签:

【中文标题】SublimeLinter:警告:jshint 已停用,无法找到“jshint”【英文标题】:SublimeLinter: WARNING: jshint deactivated, cannot locate 'jshint' 【发布时间】:2014-09-22 07:52:35 【问题描述】:

这完全是随机发生的。我所做的只是重新启动 Sublime,接下来我知道我必须重新设置 git.exe 的路径,而 SublimeLinter jshint 已损坏。我已按各种顺序删除并重新安装了 SublimeLinter 和 SublimLinter-jshint 以尝试修复它。

我还使用 npm 全局安装了 jshint。

SublimeLinter 默认/用户设置:


    "default": 
        "debug": false,
        "delay": 0.25,
        "error_color": "D02000",
        "gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
        "gutter_theme_excludes": [],
        "lint_mode": "background",
        "mark_style": "outline",
        "no_column_highlights_line": false,
        "paths": 
            "linux": [],
            "osx": [],
            "windows": ["C:\\Users\\x\\AppData\\Roaming\\npm\\node_modules\\jshint\\bin"]
        ,
        "python_paths": 
            "linux": [],
            "osx": [],
            "windows": []
        ,
        "rc_search_limit": 3,
        "shell_timeout": 10,
        "show_errors_on_save": false,
        "show_marks_in_minimap": true,
        "syntax_map": 
            "python django": "python",
            "html 5": "html",
            "html (django)": "html",
            "html (rails)": "html",
            "php": "html"
        ,
        "warning_color": "DDB700",
        "wrap_find": true
    

控制台:

SublimeLinter: jshint linter loaded 
reloading plugin SublimeLinter.commands
reloading plugin SublimeLinter.sublimelinter
plugins loaded
SublimeLinter: debug mode: on 
SublimeLinter: temp directory: c:\users\x\appdata\local\temp\SublimeLinter3 
SublimeLinter: computed PATH from system:
C:\Users\x\AppData\Roaming\npm\node_modules\jshint\bin
C:\Program Files\Common Files\Microsoft Shared\Windows Live
C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Program Files\ThinkPad\Bluetooth Software\
C:\Program Files\ThinkPad\Bluetooth Software\syswow64
C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static
C:\Program Files (x86)\Common Files\Lenovo
C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\
C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\
C:\Program Files (x86)\Lenovo\Access Connections\
C:\Program Files\Common Files\Lenovo
C:\Program Files (x86)\Lenovo\Client Security Solution
C:\Program Files\Lenovo\Client Security Solution
C:\Program Files (x86)\OpenLDAP\kfw\Binary
C:\Program Files (x86)\Windows Live\Shared
C:\Program Files\Microsoft\Web Platform Installer\
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\
C:\Program Files\Microsoft SQL Server\110\Tools\Binn\
C:\PROGRA~1\IBM\SQLLIB\BIN
C:\PROGRA~1\IBM\SQLLIB\FUNCTION
C:\Program Files\nodejs\
C:\Python27

SublimeLinter: WARNING: jshint deactivated, cannot locate 'jshint' 
SublimeLinter: found existing HTML syntax, version 3 
SublimeLinter: found existing Rails syntax, version 1 
found 3 files for base name Main.sublime-menu
Package Control: Skipping automatic upgrade, last run at 2014-07-30 10:51:51, next run at 2014-07-30 11:51:51 or after

【问题讨论】:

SublimeLinter 要求你的路径中有 jshint。您是否尝试过打开终端窗口并查看输入jshint --version 会发生什么?您应该会看到类似 jshint v2.5.0 的回复。 哦...我认为 SublimeLinter 知道路径是它(那么有点多余...?)。好的。把它放在 PATH 里面就可以了。谢谢。 听起来不错,我会发布它作为答案。 【参考方案1】:

另外,如果您像我一样,由于工作场所的限制而无法修改您的 Windows PATH 变量,您可以像我在这里所做的那样将路径添加到默认用户设置Comment on SublimeLinter。这适用于 Sublime 3 build 3065。


    "default": 
        "debug": false,
        "delay": 0.25,
        "error_color": "D02000",
        "gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
        "gutter_theme_excludes": [],
        "lint_mode": "background",
        "mark_style": "outline",
        "no_column_highlights_line": false,
        "paths": 
            "linux": [],
            "osx": [],
            "windows": ["C:/Users/myUserName/AppData/Roaming/npm"]
        ,
        "python_paths": 
            "linux": [],
            "osx": [],
            "windows": []
        ,
        "rc_search_limit": 3,
        "shell_timeout": 10,
        "show_errors_on_save": false,
        "show_marks_in_minimap": true,
        "syntax_map": 
            "python django": "python",
            "html 5": "html",
            "html (django)": "html",
            "html (rails)": "html",
            "php": "html"
        ,
        "warning_color": "DDB700",
        "wrap_find": true
    

【讨论】:

实际上,它在 win 8 机器上帮助了我。【参考方案2】:

根据SublimeLinter documentation,它要求您的路径中有 linter 可执行文件。

大多数 linter 插件要求您安装 linter 二进制文件或库 并配置你的 PATH 以便 SublimeLinter 可以找到它。你必须 按照 linter 插件的安装说明成功 使用它。

您是否尝试过打开终端窗口并查看如果您输入 jshint --version 会发生什么?如果它已经在您的路径中,您应该会看到类似 jshint v2.5.0 的响应。

【讨论】:

以上是关于SublimeLinter:警告:jshint 已停用,无法找到“jshint”的主要内容,如果未能解决你的问题,请参考以下文章

ST2:SublimeLinter 忽略 JSHint 设置

Sublime Text 3 SublimeLinter 插件无法找到 jshint

防止 JSHint 警告“功能名称已定义但从未使用”

SublimeLinter 3 不工作

如何为每个文件夹配置 sublimelinter

SublimeLinter javascript 与 php