2

我安装了 JSHint:

alex@alex-K43U:~$ which jshint
/home/alex/nvm/v0.8.8/bin/jshint
'/home/alex/.vim/bundle/syntastic' 

我在我的.vimrc

" Syntastic
let g:syntastic_check_on_open=1
let g:syntastic_javascript_checkers = ['jshint']
let g:syntastic_jshint_exec='/home/alex/nvm/v0.8.8/bin/jshint'

Vim 似乎正在检测它:

Syntastic: active mode enabled
Syntastic info for filetype: javascript
Available checker(s): jshint
Currently enabled checker(s): jshint

但是当我打开一个.js文件时,我会得到这样的东西:

检查器 javascript/jshint 返回异常状态

并且根本没有错误突出显示。可能是什么问题呢?

(我什.jshintrc至在我的路径中添加了一个文件home但没有运气)

编辑:

"~/www/coffeescript/js/script.js" 11L, 193C
syntastic: 8.443991: g:syntastic_version = '3.4.0'
syntastic: 8.455821: &shell = '/bin/bash', &shellcmdflag = '-c', &shellpipe = '2>&1| tee', &shellquote = '', &shellredir = '>%s 2>&1', &shellslash = 0, &shellt
emp = 1, &shellxquote = ''
syntastic: 8.508374: g:syntastic_aggregate_errors = 0
syntastic: 8.528577: getcwd() = /home/alex
syntastic: 8.567175: CacheErrors: Invoking checker: javascript/jshint
syntastic: 8.625888: SyntasticMake: called with options: {'errorformat': '%E%f: line %l\, col %v\, %m', 'defaults': {'bufnr': 1}, 'makeprg': '/home/alex/nvm/v0
.8.8/bin/jshint --config ~/.jshintrc /home/alex/www/coffeescript/js/script.js', 'returns': [0, 2]}
syntastic: 8.688247: checker output: ['/usr/bin/env: node: No such file or directory', '']
syntastic: 8.707693: raw loclist: [{'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': '/usr/bin/env: node: N
o such file or directory'}, {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ''}]
4

1 回答 1

1

我只是在使用 jshint v2.6.3 时遇到了这个问题。对我来说,问题是我.jshintrc的格式不正确。我从另一个 SO question 中获取了文件的内容,但没有意识到我需要将所有内容都包裹在花括号中。

在我的项目目录中打开我.jshintrc并更改:

"globals": {
    "angular": true
}

{
  "globals": {
    "angular": true
  }
}

为我做了诀窍。这可能不是您的问题,但希望这会对某人有所帮助!

于 2015-03-08T23:26:44.903 回答