Steven W.
Steven W.

Reputation: 111

Works in IRB from Terminal but not in Sublime

At first I was running into issues with this code in both the Terminal's IRB and in Sublime but after troubleshooting them, it was fixed in IRB but I was still getting the error msg (listed below) in Sublime. Any assistance would greatly be appreciated.

P.S. I'm a Ruby noob

This is the code that I put in Sublime Text

require 'rubygems'
require 'RedCloth'

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

This is the error message that I get in Sublime when I run it

/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 require' from /Users/StevenW/Documents/Code/ruby/beginning_ruby/test.rb:2:in `' [Finished in 9.0s with exit code 1] [shell_cmd: ruby "/Users/StevenW/Documents/Code/ruby/beginning_ruby/test.rb"] [dir: /Users/StevenW/Documents/Code/ruby/beginning_ruby] [path: /usr/bin:/bin:/usr/sbin:/sbin]

Upvotes: 0

Views: 297

Answers (1)

Anbin Muniandy
Anbin Muniandy

Reputation: 724

Make sure you're default ruby is set properly so that Sublime can run it.

I see that you are using rvm

rvm use 2.0.0 --default

Then run the following command.

gem install RedCloth

Run it again in Sublime. It should work.

Upvotes: 1

Related Questions