I have installed Syntastic with Pathogen.
Syntastic works for Python files but not for JavaScript files with JSHint. JSHint works via command line or with other vim plugin like https://github.com/Shutnik/jshint2.vim
→ which jshint
/usr/local/share/npm/bin/jshint
→ jshint --version
jshint v2.1.10
→ echo $PATH
/usr/local/share/npm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
When I run :SyntasticInfo, it doesn't find any checkers.
Syntastic info for filetype: javascript
Available checkers:
Currently active checker(s):
My vimrc
set nocompatible
filetype off
call pathogen#infect()
call pathogen#helptags()
filetype plugin indent on
syntax on
let g:syntastic_check_on_open=1
let g:syntastic_javascript_checkers = ['jshint']
I don't know what I've missed, if you have any idea why Syntastic doesn't detect JSHint. Thanks
I encountered a similar problem on Windows 8. After installing nodejs
v0.10.22 and syntastic
>= 3.2.0, the Vim command :SyntasticInfo
would give me:
Syntastic: active mode enabled
Syntastic info for filetype: vim
Available checker(s):
Currently enabled checker(s):
The documentation over at jshint.com/docs suggests that this is sufficient to install the module.
$ npm install jshint -g
This is true, apart from a somewhat surprising meaning of flag -g installs JSHint globally on your system. It means in your user's %AppData% folder:
(abbreviated output from previous command)
C:\Users\jaroslav\AppData\Roaming\npm\jshint -> \
C:\Users\jaroslav\AppData\Roaming\npm\node_modules\jshint\bin\jshint
[email protected] C:\Users\jaroslav\AppData\Roaming\npm\node_modules\jshint
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected])
Another piece of documentation from the syntastic FAQ reads:
Q. I installed syntastic but it isn't reporting any errors...
A. The most likely reason is that none of the syntax checkers that it requires is installed. For example: python requires either flake8, pyflakes or pylint to be installed and in $PATH. To see which executables are supported, just look in syntax_checkers//*.vim. Note that aliases do not work; the actual executable must be available in your $PATH. Symbolic links are okay. You can see syntastic's idea of available checkers by running :SyntasticInfo.
The solution amounts to setting the path of the jshint
command in ~/.vimrc:
let g:syntastic_jshint_exec='C:\Users\jaroslav\AppData\Roaming\npm\jshint.cmd'
:source $HOME/_vimrc
:SyntasticInfo
Syntastic: active mode enabled
Syntastic info for filetype: javascript
Available checker(s): jshint
Currently enabled checker(s): jshint
Alternatively, one could:
> cmd.exe
> cd C:\Users\jaroslav\AppData\Roaming\npm
> setx PATH "%cd%:%PATH%"
and let g:syntastic_jshint_exec='jshint.cmd'
. I didn't try the last solution with %PATH% because Winders doesn't like long %PATH% variables.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With