BeautifyRuby icon indicating copy to clipboard operation
BeautifyRuby copied to clipboard

Error: invalid output. Check your ruby interpreter setting (only with ERB files)

Open dwkns opened this issue 9 years ago • 8 comments

On OS X 10.11.2 - Sublime Text 3

I have the htmlbeautifier gem (1.1.1) properly installed. From the terminal htmlbeautifier my_file.html.erb works as expected and beautifies the file.

The plugin is installed (via package control) and works for standard ruby (.rb) files.

However the I get the 'Error: invalid output. Check your ruby interpreter setting' error whenever I try to beautify a .erb file within Sublime.

Any ideas?

dwkns avatar Jan 16 '16 11:01 dwkns

I'm experiencing this too. The README addresses this...but even with the htmlbeautifier gem installed, I still get the error.

atstockland avatar Apr 18 '16 13:04 atstockland

I came accross this issue too . System :** OS X EL Capitan** , version 10.11.5 , with sublime3, When i use the short cut in *.html.erb file , there always be a alert showing :

Error: invalid out put. Check your ruby interpreter settings .

I have install ruby with brew. Ruby version is :

ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin15]

monjer avatar May 24 '17 14:05 monjer

After google , I think I get the right answer , In my situation , because I reinstall the ruby with brew , I have to change the ruby path in the preference of BeautifyRuby .

So change to preferences > package settings > beautify ruby > settings default , and add the option "ruby": "path/of/ruby"

save the prefernce and all is done.

you can check the solution in stackoverflow:

monjer avatar May 24 '17 14:05 monjer

To save the next visitor a click, the secret is to tell rvm to use your global gemset:

$ which ruby
/Users/jonathan/.rvm/rubies/ruby-2.3.3/bin/ruby
$ rvm use 2.3.3@global
Using /Users/jonathan/.rvm/gems/ruby-2.3.3 with gemset global
$ gem install htmlbeautifier

or

$ rvm @global do gem install htmlbeautifier

jabbett avatar Jun 06 '17 14:06 jabbett

For me $ sudo gem install htmlbeautifier worked

madeindjs avatar Aug 08 '17 11:08 madeindjs

Solutions

  1. Make sure you point sublime to your ruby path.
  2. Make sure you have the htmlbeautifier ruby gem installed.

1. Ruby Path:

image

// this is for rbenv; change the ruby path if you are using rvm or another ruby version manager:
{
    "ruby": "~/.rbenv/shims/ruby",  
    "file_patterns": ["\\.html\\.erb", "\\.rb", "\\.rake", "Rakefile", "Gemfile", "Vagrantfile"],
    "html_erb_patterns": ["\\.html\\.erb"],
    "run_on_save": true,
    "save_on_beautify": true
}

2. Install htmlbeautifier

Should I sudo install a gem?...with the utmost respect, consider carefully whether sudo installing gems is something you should do.

You can simply use rbenv and: gem install htmlbeautifier, with the above settings, and hopefully it will Just Work (TM).

benkoshy avatar Aug 06 '18 04:08 benkoshy

@jabbett Helped alot!!! Thanks!! :)

mahmoudRateb avatar Nov 15 '18 08:11 mahmoudRateb

@benkoshy this worked, thanks!!

sljmn avatar Feb 18 '24 22:02 sljmn