我目前正在运行Sublime Text 3并使用rbenv和ruby版本2.3.0。我从Package Control安装了Beatify Ruby但它无法正常运行。我每次在Sublime中运行BeautifyRuby时都会出现错误,它说:
Error: invalid output. Check your ruby interpreter settings
让Beautify Ruby工作的最佳方法是什么?
答案 0 :(得分:1)
如果收到此错误,BeautifyRuby似乎不知道您的ruby解释器在哪里(它需要运行执行“美化”的ruby脚本)。为了解决这个问题,您需要通过在BeautifyRuby-Package-settings中提供正确的解释器路径来指定ruby解释器:
which ruby
。这样会给您类似/home/<yourusername>/.rbenv/shims/ruby
(如果使用rbenv)或~/.rvm/bin/rvm-auto-ruby
(如果使用rvm)Preferences > Package Settings > BeautifyRuby > Settings - Default
{
// Specify your ruby interpreter:
"ruby": "~/.rvm/bin/rvm-auto-ruby",
// Examples for other settings:
// Use 2 Spaces instead of tabs:
"translate_tabs_to_spaces": true,
"tab_size": 2,
// You can change the file patterns handled by this plugin:
"file_patterns": ["\\.html\\.erb", "\\.rb", "\\.rake", "Rakefile", "Gemfile", "Vagrantfile"],
"html_erb_patterns": ["\\.html\\.erb"],
// This package offers a pre-save hook; when activated, your ruby and erb files will
// be reformatted automatically before saving (deactivated by default)
"run_on_save": false,
// The sublime command "beautify_ruby" performs a save after formatting.
// (activated by default)
"save_on_beautify": false
}
ctrl+alt+k
)-您的代码应该包含被“美化”。 有关更多详细信息,请检查项目页面-GitHub或packagecontrol.io上
答案 1 :(得分:-1)
尝试从shell cd project_forler && subl .
或打开偏好设置 - &gt;包装设置 - &gt; BeautifyRuby - &gt;设置默认值
找到"ruby": "ruby"
并替换为红宝石路径