Search code examples
sublimetext3sublimetextsublime-jslint

No such file or directory: 'jshint'


On sublime text I'm getting following error while trying to validate JS.

[Errno 2] No such file or directory: 'jshint'
[cmd: ['jshint', '/Users/vladislavkopylov/Downloads/test.js', '--reporter', '/Users/vladislavkopylov/Library/Application Support/Sublime Text 3/Packages/JSHint/reporter.js']]
[dir: /Users/vladislavkopylov/Downloads]
[path: /usr/local/share/npm/bin:/usr/local/bin:/opt/local/bin]
[Finished]

Solution

  • I'm using Sublime 3 && Debian 9.3 and faced the same problem. Here's my solution:

    1) npm install -g jshint

    2) Preferences -> Browse Packages... and open JSHint/JSHint.py (/home/user/.config/sublime-text-3/Packages/JSHint/JSHint.py)

    Search for:

    if sublime.platform() == "windows":
        args['cmd'][0] += ".cmd"
    elif sublime.platform() == "osx":
        args['path'] = "/usr/local/share/npm/bin:/usr/local/bin:/opt/local/bin"
    

    I've added the following line after that (to overwrite args['path']):

    args['path'] = "/home/alexismaster/.nvm/v0.10.29/bin:/usr/local/share/npm/bin:/usr/local/bin:/opt/local/bin"
    

    I.e. I've added this path: /home/alexismaster/.nvm/v0.10.29/bin The condition seems to be unnecessary since my OS is not there anyway

    You probably have it different since I'm using NVM and at the moment version is 0.10.29

    3) Restart Sublime