3

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]
Xantium
  • 11,201
  • 10
  • 62
  • 89
user3517175
  • 363
  • 2
  • 14
  • Possible duplicate of [Sublime \[Errno 2\] No such file or directory: 'node'](http://stackoverflow.com/questions/18014360/sublime-errno-2-no-such-file-or-directory-node) – Jack Nov 29 '15 at 15:47

1 Answers1

3

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

YakovL
  • 7,557
  • 12
  • 62
  • 102
husky
  • 56
  • 2