3

在崇高的文本上,我在尝试验证 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]
4

1 回答 1

3

我正在使用 Sublime 3 && Debian 9.3 并面临同样的问题。这是我的解决方案:

1) npm install -g jshint

2) Preferences -> Browse Packages... 并打开 JSHint/JSHint.py (/home/user/.config/sublime-text-3/Packages/JSHint/JSHint.py)

搜索:

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"

之后我添加了以下行(以覆盖 args['path']):

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

即我添加了这个路径:/home/alexismaster/.nvm/v0.10.29/bin 这个条件似乎是不必要的,因为我的操作系统不在那里

你可能有不同,因为我使用的是 NVM,目前版本是 0.10.29

3) 重启 Sublime

于 2018-02-01T21:16:27.900 回答