attenzione/SublimeLinter-scss-lint

Not linting - /usr/local/bin/ruby: No such file or directory -- scss-lint (LoadError)

ronilaukkarinen opened this issue · 17 comments

Hello,

Linter is not working for me at the moment. I have gone through literally every GitHub issue that is close to mine, but no luck.

Console output:

SublimeLinter: #2 linter.py:738: 'scsslint' is linting '_pricing.scss'
SublimeLinter: #2 linter.py:1184: Running ...

  /Users/rolle/Projects/adminlabs  (working dir)
  $ cat content/themes/adminlabs/sass/modules/_pricing.scss | /usr/bin/ruby -S scss-lint /Users/rolle/Projects/adminlabs/content/themes/adminlabs/sass/modules/_pricing.scss

SublimeLinter: #2 linter.py:500: WARNING: scsslint output:
/usr/bin/ruby: No such file or directory -- scss-lint (LoadError)

SublimeLinter: #2 linter.py:502: Note: above warning will become an error in the future. Implement `on_stderr` if you think this is wrong.
SublimeLinter: sublime_linter.py:287: Linting buffer 58 took 0.15s

When I run manually cd /Users/rolle/Projects/adminlabs/ and then cat content/themes/adminlabs/sass/modules/_pricing.scss | /usr/local/bin/ruby -S scss-lint /Users/rolle/Projects/adminlabs/content/themes/adminlabs/sass/modules/_pricing.scss it works just fine from command line.

macOS Sierra
Sublime Text 3, Build: 3175
scss-lint -v: scss-lint 0.57.0
ruby -v: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin16]

SublimeLinter.sublime-settings

  {
    // Set to true to print extra information in the console.
    "debug": true,

    // When in the "background" lint mode, this value determines
    // a delay before a request is send to the linter
    "delay": 0.25,

    // Available gutter themes:
    // Blueberry Cross
    // Blueberry Round
    // Circle
    // Danish Royalty
    // Default
    // Hands
    // Knob
    // Knob Symbol
    // Koloria
    // ProjectIcons
    // Note that you may need to change the "icon" property in "styles"
    // to an icon in the theme (they usually include "warning" and "error")
    "gutter_theme": "Default",

    // Lint Modes determine when the linter is run
    // background: asynchronously on every change
    // load_save: when a file is opened and every time it's saved
    // manual: only when calling the Lint This View command
    "lint_mode": "background",    
    "linters":
    {
      "csslint":
      {
        "disable": false,
        "args":
        [
        ],
        "errors": "",
        "excludes":
        [
        ],
        "ignore": "",
        "warnings": ""
      },
      "phpcs":
      {
        "disable": false,
        "standard": "${folder}/content/themes/${project_base_name}/phpcs.xml",
        "args":
        [
        ],
        "cmd": "/Users/rolle/Projects/phpcs/scripts/phpcs",
        "excludes":
        [
        ],
        "paths":
        {
          "linux":
          [
            "/Users/rolle/Projects/phpcs/scripts/",
            "/Users/rolle/Projects/phpcs/bin/",
            "/usr/local/bin/"
          ],
          "osx":
          [
            "/Users/rolle/Projects/phpcs/scripts/",
            "/Users/rolle/Projects/phpcs/bin/",
            "/usr/local/bin/"
          ],
          "windows":
          [
          ]
        },
      },
      "sass":
      {
        "disable": true,
        "args":
        [
        ],
        "excludes":
        [
        ]
      },
      "scss":
      {
        "disable": false,
        "args":
        [
        ],
        "exclude-linter": "",
        "excludes":
        [
        ],
        "include-linter": ""
      },
      "sublimesyntax":
      {
        "disable": false,
        "args":
        [
        ],
        "excludes":
        [
        ]
      }
    },
    "no_column_highlights_line": false,
    "paths":
    {
      "linux":
      [
      ],
      "osx":
      [
        "/usr/local/bin/"
      ],      "windows":
      [
      ]
    },
    "show_marks_in_minimap": true,
    "syntax_map":
    {
      "html (django)": "html",
      "html (rails)": "html",
      "html 5": "html",
      "php": "html",
      "python django": "python"
    },
  }

Solved this myself by adding this to Library/Application\ Support/Sublime\ Text\ 3/Packages/User/Ruby.sublime-settings

{
  "env":{
      "PATH":"/usr/local/bin:${PATH}"
  },
	"extensions":
	[
	]
}

Just for googlers to know... it happened again so I investigated this for hours. For some reason it loads up "too early" and loses the path. By increasing shell_timeout the problem is finally gone. See this for solution.

I just noticed this is still bugging. No help editing Ruby.sublime-settings... can somebody help me out?

SublimeLinter: #6 linter.py:907: 'scsslint' is linting '_navigation.scss'
SublimeLinter: #6 linter.py:1263: Running ...

  /Users/rolle/Projects/dude  (working dir)
  $ cat content/themes/dude/sass/layout/_navigation.scss | /usr/bin/ruby -S scss-lint /Users/rolle/Projects/dude/content/themes/dude/sass/layout/_navigation.scss

SublimeLinter: #6 linter.py:589: WARNING: scsslint output:
/usr/bin/ruby: No such file or directory -- scss-lint (LoadError)

SublimeLinter: #6 linter.py:591: Note: above warning will become an error in the future. Implement `on_stderr` if you think this is wrong.
SublimeLinter: sublime_linter.py:444: Linting buffer 25 took 0.06s

You're launching sublime with different PATH, than your command line. Try to launch Sublime from terminal. I have in my .bash_profile

alias subl="open -a /Applications/Sublime\ Text.app"

and launch Sublime with command

$ subl .

Never have PATH issues.

Btw, previously your ruby executable was in /usr/local/bin/, but now in /usr/bin/. You changed installation, did you installed scss-lint gem?

I use mac os dock launcher a lot, even though sometimes I open stuff from command line. But how to get path to /usr/local/bin/ all the time working? I don't know why it changed back to /usr/bin.

On macos you cannot install gems via default ruby provided by the system (/usr/bin), with command cat content/themes/dude/sass/layout/_navigation.scss | /usr/local/bin/ruby -S scss-lint /Users/rolle/Projects/dude/content/themes/dude/sass/layout/_navigation.scss everything works as they should, with cat content/themes/dude/sass/layout/_navigation.scss | /usr/bin/ruby -S scss-lint /Users/rolle/Projects/dude/content/themes/dude/sass/layout/_navigation.scss won't...

use https://github.com/rbenv/rbenv#homebrew-on-macos and forget about system ruby on mac

Did you tried to install via rbenv and correctly set global ruby version? It's not ST problem with ruby.
what is output of which ruby?

which ruby shows /usr/local/bin/ruby, as it should.

Actually, I have rbenv installed but not in use, I use direct ruby installed in /usr/local/bin/ruby as I stated. But also tried with uncommenting eval "$(rbenv init -)" in .bash_profile, after it shows like this:

 ~ curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
Checking for `rbenv' in PATH: /usr/local/bin/rbenv
Checking for rbenv shims in PATH: OK
Checking `rbenv install' support: /usr/local/bin/rbenv-install (ruby-build 20180424)
Counting installed Ruby versions: 2 versions
Checking RubyGems settings: OK
Auditing installed plugins: OK
~ which ruby
/Users/rolle/.rbenv/shims/ruby
~ 

So everything is fine with ruby with any way to install it, rbenv, rvm or /usr/local/bin.

Now rbenv ruby is active, and when running Sublime Text with console on, editing SCSS, still getting this:

SublimeLinter: sublime_linter.py:444: Linting buffer 30 took 0.07s
SublimeLinter: sublime_linter.py:250: Delay buffer 30 for 0.3s
SublimeLinter: linter.py:887: Checking lint mode background vs lint reason None
SublimeLinter: #3 linter.py:907: 'scsslint' is linting '_contact.scss'
SublimeLinter: #3 linter.py:1263: Running ...

  /Users/rolle/Projects/dude  (working dir)
  $ cat content/themes/dude/sass/views/_contact.scss | /usr/bin/ruby -S scss-lint /Users/rolle/Projects/dude/content/themes/dude/sass/views/_contact.scss

SublimeLinter: #3 linter.py:589: WARNING: scsslint output:
/usr/bin/ruby: No such file or directory -- scss-lint (LoadError)

SublimeLinter: #3 linter.py:591: Note: above warning will become an error in the future. Implement `on_stderr` if you think this is wrong.
SublimeLinter: sublime_linter.py:444: Linting buffer 30 took 0.08s

Any practical tips?

I'm having the same problem. macOS 10.13.6, Mac's preinstalled ruby.

Sublime Text 3 Build: 3175
scss-lint 0.57.0
which ruby /usr/bin/ruby
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin17]

SublimeLinter: #1 linter.py:589: WARNING: scsslint output:
/usr/bin/ruby: No such file or directory -- scss-lint (LoadError)

Direct commands to $ /usr/bin/ruby -S scss-lint work as expected.

As a workaround I created a launcher for subl with Appify-UI as via command line the linter works fine. It frustrates the hell out of me that I can't get it work any other way.

I still have this problem, Appify is very clumsy solution after all. I'm used to launch ST via gui so i've been without linter now... Did any solutions come up?

Please configure your Sublime to use correct executables, otherwise it can be forced with SublimeLinter configuration.

I'm closing it, it's not related to plugin.

Yes, I have configured it, but it doesn't fix it for me. This is my current configuration of SublimeLinter.sublime-settings (scss-part of it):

"scss":
      {
        "executable": "/usr/local/bin/ruby",
        "disable": false,
        "env": {"PATH":"/usr/local/bin/"},
        "paths":
        {
          "linux":
          [
            "/usr/local/bin/"
          ],
          "osx":
          [
            "/usr/local/bin/"
          ],
          "windows":
            "/usr/local/bin/"
          [
          ]
        }        
      },

Still getting /usr/bin/ruby: No such file or directory -- scss-lint (LoadError). All other linters work fine without much configuring.

Now I feel stupid. The correct configuration is of course "scsslint", not "scss"... that's why my configurations were not recognized. So finally case solved, after all this time.

don't feel so, it just typo ;)

Had this problem again on new Mac. Just to Note to self and future googlers, you sometimes need to add both /usr/local/bin and local .rvm or rbenv wheter you use to path with variable, like this: "env": {"PATH":"/usr/local/bin/:/Users/rolle/.rvm/rubies/ruby-2.6.3/bin:${PATH}"},.

In case you want to copy my whole SublimeLinter.sublime-settings, here it goes:

  {
    // Set to true to print extra information in the console.
    "debug": true,

    // When in the "background" lint mode, this value determines
    // a delay before a request is send to the linter
    "delay": 0.25,

    // Available gutter themes:
    // Blueberry Cross
    // Blueberry Round
    // Circle
    // Danish Royalty
    // Default
    // Hands
    // Knob
    // Knob Symbol
    // Koloria
    // ProjectIcons
    // Note that you may need to change the "icon" property in "styles"
    // to an icon in the theme (they usually include "warning" and "error")
    "gutter_theme": "Default",

    // Lint Modes determine when the linter is run
    // background: asynchronously on every change
    // load_save: when a file is opened and every time it's saved
    // manual: only when calling the Lint This View command
    "lint_mode": "background",    
    "linters":
    {
      "csslint":
      {
        "disable": false,
        "args":
        [
        ],
        "errors": "",
        "excludes":
        [
        ],
        "ignore": "",
        "warnings": ""
      },
      "sass":
      {
        "disable": true
      },
      "phpcs":
      {
        "disable": false,
        "standard": "${folder}/content/themes/${project_base_name}/phpcs.xml",
        "executable": "/Users/rolle/Projects/phpcs/scripts/phpcs",
        "args": ["--standard=${folder}/content/themes/${project_base_name}/phpcs.xml"],
        "excludes":
        [
        ],
        "paths":
        {
          "linux":
          [
            "/Users/rolle/Projects/phpcs/scripts/",
            "/Users/rolle/Projects/phpcs/bin/",
            "/usr/local/bin/"
          ],
          "osx":
          [
            "/Users/rolle/Projects/phpcs/scripts/",
            "/Users/rolle/Projects/phpcs/bin/",
            "/usr/local/bin/"
          ],
          "windows":
          [
          ]
        },
      },
      "scsslint":
      {
        "executable": "/Users/rolle/.rvm/rubies/ruby-2.6.3/bin/ruby",
        "cmd": "/Users/rolle/.rvm/rubies/ruby-2.6.3/bin/ruby",
        "disable": false,
        "env": {"PATH":"/usr/local/bin/:/Users/rolle/.rvm/rubies/ruby-2.6.3/bin:${PATH}"},
        "paths":
        {
          "linux":
          [
            "/usr/local/bin/"
          ],
          "osx":
          [
            "/Users/rolle/.rvm/rubies/ruby-2.6.3/bin"
          ],
          "windows":
          [
            "/usr/local/bin/"
          ]
        }        
      },      
      "sublimesyntax":
      {
        "disable": false,
        "args":
        [
        ],
        "excludes":
        [
        ]
      }
    },
    "no_column_highlights_line": false,
    "show_marks_in_minimap": true,
    "syntax_map":
    {
      "html (django)": "html",
      "html (rails)": "html",
      "html 5": "html",
      "php": "html",
      "python django": "python"
    },
  }