SublimeLinter-rubocop: /usr/bin/ruby: No such file or directory -- bundle (LoadError)
Having these Sublime Linter settings:
// SublimeLinter Settings - User
{
"debug": true,
"linters": {
"rubocop": {
"use_bundle_exec": true
}
},
"paths": {
"osx": [
"~/.gems/bin"
]
}
}
I still get /usr/bin/ruby: No such file or directory -- bundle (LoadError):
SublimeLinter: #7 SublimeLinter.sublime-package:747: 'rubocop' is linting 'main.rb'
SublimeLinter: #7 SublimeLinter.sublime-package:1045: rubocop: main.rb ['/usr/bin/ruby', '-S', 'bundle', 'exec', 'rubocop', '--format', 'emacs', '--force-exclusion', '--stdin', '/path/to/main.rb']
SublimeLinter: #7 SublimeLinter.sublime-package:1048: rubocop: cwd: /path/to
SublimeLinter: #7 SublimeLinter.sublime-package:774: rubocop output:
/usr/bin/ruby: No such file or directory -- bundle (LoadError)
SublimeLinter: #7 SublimeLinter.sublime-package:815: rubocop: No match for line: '/usr/bin/ruby: No such file or directory -- bundle (LoadError)'
Bundler was installed using the official instructions and is available in the PATH:
> which rubocop
/Users/revolt/.gems/bin/rubocop
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 5
- Comments: 17 (9 by maintainers)
I’ve run into the same issue. At minimum it should start with
/usr/bin/env rubyinstead of/usr/bin/ruby, since the various ruby version managers etc. will work correctly if you use the env ruby instead of system.One user noted (elsewhere) that using Sublime 3.2 the PATH is correct, and the patch https://github.com/SublimeLinter/SublimeLinter/pull/1509 is not necessary anymore. Maybe someone can try that, and report back.
The interesting (and suprising) part for this linter is that it always starts with
ruby -Sas command. This means SublimeLinter, the framework, never actually tries a simplewhich rubocop, instead it trieswhich ruby, and then does a/path/to/ruby -S rubocop.@joshmfrankel Do you use the master version or my PR #55? I would suspect that it runs
~/.asdf/shims/rubocop -S rubocopif you set executable that way.I saw that ordering issue before. Don’t know why that happens for some users. (SublimeLinter should not be the cause here. Since we never figured a fix that works for all users, we decided to not ship any fix at all.)
A proposed fix can be found here https://github.com/SublimeLinter/SublimeLinter/pull/1509 This is pretty much a stand-alone fix that can be installed via copy/paste. See the instructions over there.
This might be related. I have a similar issue, seemingly caused by PATH being in the wrong order.
Of course running from a shell resolves to the correct binary.
Mitigated with the following configuration, but shouldn’t be needed.