attenzione/SublimeLinter-scss-lint

Could not find 'scss-lint'

thierrymichel opened this issue · 15 comments

Hi,

First of all, thanks for this package!

But it does not work for me :(
scss-lint works correctly via Command Line.
Paths seem to be correct.
I have no problem with other linters…

I did some research, uninstall, re-install, google groups, …
Now, I try here!

config

  • Mac OS X : 10.9.2
  • rvm : 1.25.25 (yes, I use RVM)
  • ruby : ruby-2.1-head
  • SublimeText3 : build 3059
  • SublimeLinter : 3.3.4
  • SublimeLinter-contrib-scss-lint : 1.0.2
  • scss-lint : 0.23.1

console output

reloading plugin SublimeLinter-contrib-scss-lint.linter
SublimeLinter: scss linter loaded 

---
SublimeLinter: debug mode: on 
SublimeLinter: user shell: /usr/local/bin/bash 
SublimeLinter: computed PATH using /usr/local/bin/bash:
/Users/tm/.rvm/gems/ruby-2.1-head/bin
/Users/tm/.rvm/gems/ruby-2.1-head@global/bin
/Users/tm/.rvm/rubies/ruby-2.1-head/bin
/Users/tm/.rvm/bin
/Users/tm/.nvm/v0.10.24/bin
/usr/local/bin
/usr/local/sbin
~/bin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/Users/tm/.rvm/gems/ruby-2.1.0@dev/bin
/Users/tm/.rvm/gems/ruby-2.1.0@global/bin
/Users/tm/.rvm/rubies/ruby-2.1.0/bin
/Users/tm/.nvm/v0.10.24/bin
/usr/local/bin
/usr/local/sbin
/Users/tm/bin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/Users/tm/.rvm/bin
/usr/local/mysql/bin
-----
SublimeLinter: scss activated: /Users/tm/.rvm/gems/ruby-2.1-head/bin/scss-lint 
-----
SublimeLinter: scss: test.scss ['/Users/tm/.rvm/gems/ruby-2.1-head/bin/scss-lint', '--config', '/Users/tm/.scss-lint.yml'] 
SublimeLinter: scss output:
/Users/tm/.rvm/rubies/ruby-2.1-head/lib/ruby/2.1.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'scss-lint' (>= 0) among 25 total gem(s) (Gem::LoadError)
    from /Users/tm/.rvm/rubies/ruby-2.1-head/lib/ruby/2.1.0/rubygems/dependency.rb:309:in `to_spec'
    from /Users/tm/.rvm/rubies/ruby-2.1-head/lib/ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:53:in `gem'
    from /Users/tm/.rvm/gems/ruby-2.1-head/bin/scss-lint:22:in `<main>'
    from /Users/tm/.rvm/gems/ruby-2.1-head/bin/ruby_executable_hooks:15:in `eval'
    from /Users/tm/.rvm/gems/ruby-2.1-head/bin/ruby_executable_hooks:15:in `<main>' 

seems, that installed scss-lint bin file is incorrect or something
from this output
from /Users/tm/.rvm/gems/ruby-2.1-head/bin/scss-lint:22:in '<main>'
your scss-lint executable is found, but not gem
could you please post source of this binary?

scss-lint source code :

#!/usr/bin/env ruby_executable_hooks
#
# This file was generated by RubyGems.
#
# The application 'scss-lint' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

version = ">= 0"

if ARGV.first
  str = ARGV.first
  str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
  if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
    version = $1
    ARGV.shift
  end
end

gem 'scss-lint', version
load Gem.bin_path('scss-lint', 'scss-lint', version)

btw, yesterday appeared version 0.24, but i think it will not helps you, but try.
need someone uses rvm, because rbenv binary completely different
@aparajita should help us with solving this :)

Thanks for your reply. Unfortunately, last version did not change anything.
Is there any "@mention notification" in Github? (@aparajita if you are listening… ^_^)

I am totally noob with Ruby.
If it can help, this is my RubyGems Environment (all needed paths seem to be corrects):

$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.2.2
  - RUBY VERSION: 2.1.2 (2014-05-06 patchlevel 93) [x86_64-darwin13.0]
  - INSTALLATION DIRECTORY: /Users/tm/.rvm/gems/ruby-2.1-head
  - RUBY EXECUTABLE: /Users/tm/.rvm/rubies/ruby-2.1-head/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/tm/.rvm/gems/ruby-2.1-head/bin
  - SPEC CACHE DIRECTORY: /Users/tm/.gem/specs
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-13
  - GEM PATHS:
     - /Users/tm/.rvm/gems/ruby-2.1-head
     - /Users/tm/.rvm/gems/ruby-2.1-head@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/tm/.rvm/gems/ruby-2.1-head/bin
     - /Users/tm/.rvm/gems/ruby-2.1-head@global/bin
     - /Users/tm/.rvm/rubies/ruby-2.1-head/bin
     - /Users/tm/.rvm/bin
     - /Users/tm/.nvm/v0.10.24/bin
     - /usr/local/bin
     - /usr/local/sbin
     - ~/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /usr/local/bin
     - /Users/tm/.rvm/gems/ruby-2.1.0@dev/bin
     - /Users/tm/.rvm/gems/ruby-2.1.0@global/bin
     - /Users/tm/.rvm/rubies/ruby-2.1.0/bin
     - /Users/tm/.nvm/v0.10.24/bin
     - /usr/local/bin
     - /usr/local/sbin
     - /Users/tm/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /usr/local/bin
     - /Users/tm/.rvm/bin
     - /usr/local/mysql/bin

👍 for the same problem, originally posted on google groups...
https://groups.google.com/forum/#!topic/sublimelinter/2DVcpB5eeVU

the relevant debug code I believe to be is

SublimeLinter: debug mode: on 
SublimeLinter: user shell: /bin/bash 
SublimeLinter: computed PATH using /bin/bash:
/Users/oller/.rvm/gems/ruby-2.1.1/bin
/Users/oller/.rvm/gems/ruby-2.1.1@global/bin
/Users/oller/.rvm/rubies/ruby-2.1.1/bin
/opt/local/bin
/opt/local/sbin
/usr/local/heroku/bin
/opt/local/bin
/opt/local/sbin
/opt/local/bin
/opt/local/sbin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/opt/X11/bin
/Users/oller/.rvm/bin

SublimeLinter: scss activated: /Users/oller/.rvm/gems/ruby-2.1.1/bin/scss-lint 
Emmet: No need to update PyV8
SublimeLinter: found existing HTML syntax, version 2 
SublimeLinter: found existing Rails syntax, version 1 
SublimeLinter: scss: _cta.scss ['/Users/oller/.rvm/gems/ruby-2.1.1/bin/scss-lint'] 
SublimeLinter: scss output:
/Users/oller/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'scss-lint' (>= 0) among 14 total gem(s) (Gem::LoadError)
    from /Users/oller/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/dependency.rb:309:in `to_spec'
    from /Users/oller/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:53:in `gem'
    from /Users/oller/.rvm/gems/ruby-2.1.1/bin/scss-lint:22:in `<main>'
    from /Users/oller/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
    from /Users/oller/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>' 

Despite the scss-lint being updated to 0.24 and available as an executable in my $PATH from terminal, sublime text 3 can't load it. I'm sure this is related to RVM, as I had the linter working previously... any suggestions greatly appreciated, it's a great linter - I miss it! :)

Basically there isn't much we can do to support RVM without adding a bunch of configuration options. Unfortunately, RVM is kind of a hack and depends on messing with the shell environment, So it's very difficult to make it work from an external process. It definitely is not something I am either interested in fixing or have time to fix.

Totally understand, shall try and get to the bottom of this, and shall update this thread if/when I find the fix. Thanks for your help with this great plugin

@aparajita thanks for replying.

This post (from you) helped me to find a workaround.
If I use subl to open Sublime Text, it works!

What path does SublimeLinter-scss-lint expect to find the gem on? Maybe I can manual move it from where it ended up to where it needs to be.

As an aside, for some reason, the Atom scss-linter plug-in seems to work OK with it where it is. Maybe it checks in multiple locations until it finds one?

I've stumbled across this recently (ST3 + SL3) and tried playing with my $PATH in many ways as well as adding the path to the config manually (used ~/.rvm/bin/rvm-auto-ruby even though it's the default, AFAIK). None of this helped. For some reason SublimeLinter-scss-lint partially ignores the @default (or any other that @global) gemset. However, it looks like there are two workarounds:

Workarounds

  • Start Sublime Text 3 from the Terminal with subl (thanks to @thierrymichel & @aparajita).
  • Install the scss-lint gem into the @global gemset with rvm @global do gem install scss-lint and start Sublime Text 3 normally. Bear in mind this kinda misses the the whole RVM point.

rvm is currently not supported, rbenv is. If someone would like to step up and implement rvm support within SublimeLinter, that would be wonderful.

@designorant Thanks for the @global workaround. That got things working for me.

Of note, when I setup SublimeLinter-rubocop today it was a little different. I ended up having to install outside of any gemset, but I didn't specify @global. That didn't work for me with scss-lint, I'm not sure why.
https://github.com/SublimeLinter/SublimeLinter-rubocop

According to http://www.sublimelinter.com/en/latest/ruby_linter.html it should only be a case of changing these two lines:

from SublimeLinter.lint import Linter, util
class Scss(Linter):

to these two

from SublimeLinter.lint import RubyLinter, util
class Scss(RubyLinter):

@jblandry Make a pull request with that change.

Done