在终端的IRB工作但不在Sublime工作

时间:2014-03-28 04:13:43

标签: ruby

起初我在终端的IRB和Sublime中遇到了这段代码的问题,但在对它们进行故障排除之后,它已在IRB中得到修复,但我仍然在Sublime中收到错误消息(在下面列出)。非常感谢任何帮助。

P.S。我是Ruby noob

这是我在Sublime Text

中添加的代码
require 'rubygems'
require 'RedCloth'

r = RedCloth.new("this is a test *test* of _using RedCloth_")
puts r.to_html

这是我运行时在Sublime中收到的错误消息

  

/usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in   require': cannot load such file -- RedCloth (LoadError) from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in 需要'从   /Users/StevenW/Documents/Code/ruby/beginning_ruby/test.rb:2:in   `' [退出代码为1的9.0s完成] [shell_cmd:ruby   " /Users/StevenW/Documents/Code/ruby/beginning_ruby/test.rb"] [dir:   / Users / StevenW / Documents / Code / ruby​​ / beginning_ruby] [路径:   的/ usr / bin中:/ bin中:/ usr / sbin目录:/ sbin目录]

1 个答案:

答案 0 :(得分:1)

确保您已正确设置默认ruby,以便Sublime可以运行它。

我发现您使用的是rvm

rvm use 2.0.0 --default

然后运行以下命令。

gem install RedCloth

在Sublime中再次运行它。它应该工作。

相关问题