sublime-jshint
sublime-jshint copied to clipboard
File not found using Alt + j on linux, not working.
When i try alt + j, this error appeared:
[Errno 2] Arquivo ou diretório não encontrado [cmd: [u'jshint', u'/home/luis/Encfs/arquivos/projetos/nodejs/scriptErp/server.js', u'--reporter', u'/home/luis/.config/sublime-text-2/Packages/JSHint/reporter.js']] [dir: /home/luis/Encfs/arquivos/projetos/nodejs/scriptErp] [path: /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games] [Finished]
i tried the command outside sublime, worked: luis@linux-pc:~$ jshint /home/luis/Encfs/arquivos/projetos/nodejs/scriptErp/app/controllers/script.js --reporter /home/luis/.config/sublime-text-2/Packages/JSHint/reporter.js [JSHint: /home/luis/Encfs/arquivos/projetos/nodejs/scriptErp/app/controllers/script.js]
26,2: Unnecessary semicolon. 37,14: Use '!==' to compare with ''. 81,10: Missing semicolon. 100,9: Missing semicolon. 102,6: Unnecessary semicolon. 106,2: Unnecessary semicolon. 127,2: Unnecessary semicolon.
✗ 7 errors, double-click above, [F4] for next, [shift-F4] for previous.
So, i found a bug in JSHint.py, not have entry for linux. So i put, i known maybe not the best way, but worked:
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"
elif sublime.platform() == "linux":
args['path'] = "/home/luis/.nvm/v0.10.20/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:
I cant get this to work on Ubuntu 14:04, where is your path for linux supposed to point to???
@stevematdavies for me on 14.04 I followed @luisantoniojr's suggestion and added these two lines:
elif sublime.platform() == "linux":
args['path'] = "/home/mstrutt/local/bin"
I found the JSHint.py file by selecting Browse Packages from the Preferences menu
I found where node was installed by running npm config list
(take /node
off the end)
@mstrutt you are right, but I made a workaround, I just put this lines on .profile
/ .bashrc
file:
// export nvm
export NVM_DIR="/home/mstrutt/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
// add node path
export PATH="$PATH:$NVM_DIR/versions/node/$(nvm_version)/bin"
and it works!