解決linter-rubocop在Atom會出現的error message

Richo, 六 26 9月 2015, Tools

atom, linter, rubocop, soa

前言

linter-rubocop是Atom的package,可以幫忙檢查寫Ruby時的coding style有沒有符合規定,安裝方式詳見reference。


Error

Error: env: ruby_executable_hooks: No such file or directory
    at /Users/username/.atom/packages/linter-rubocop/index.coffee:18:15

Solution

按照官方的設定教學,我們在搜尋rubocop的path時會出現:

which rubocop
# /Users/username/.rvm/gems/ruby-2.2.1/bin/rubocop

導致,Atom的設定會變成:

'linter-rubocop':
    'executablePath': '/Users/username/.rvm/gems/ruby-2.2.1/bin/rubocop'

此時換成:

'linter-rubocop':
    # Replace 'bin' to 'wrappers'
    'executablePath': '/Users/username/.rvm/gems/ruby-2.2.1/wrappers/rubocop'

重啟Atom,便不會再出現error message。


Reference

+linter-rubocop
+Linter can't find env: ruby_executable_hooks