简体   繁体   中英

Problems setting Vim + Syntastic + JSHint (Linux)

I have JSHint installed:

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

And I'm pointing to it on my .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 seems to be detecting it:

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

But when I open a .js file I get stuff like this:

checker javascript/jshint returned abnormal status

And no error highlight at all. What could be the problem?

(I even added a .jshintrc file in my home path but no luck)

EDIT:

"~/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': ''}]

I was just having this issue with jshint v2.6.3. The issue for me was that my .jshintrc was malformed. I took my the contents of the file from another SO question and didn't realize that I needed to have everything wrapped in curly braces.

Opening my .jshintrc in my project directory and changing:

"globals": {
    "angular": true
}

to

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

Did the trick for me. This might not be your issue, but hopefully this will help someone!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM