Problem using Sinatra #227

Closed
chariotsofthegods opened this Issue Mar 23, 2011 · 12 comments

Projects

None yet

4 participants

@chariotsofthegods

getting the folllowing error.

ruby main.rb

/home/jithesh/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require': no such file to load -- sinatra (LoadError) from /home/jithesh/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from main.rb:2:in `

'

I checked the 'IGNORE' part in base.rb. It has that </internal code added right there. No clue what is happening. Guys

@rkh
Member
rkh commented Mar 23, 2011

Seems like require can't find sinatra. Do you have it installed? What gives ruby -s gem which sinatra?

@chariotsofthegods

I have installed it. But I get the following.
ruby -s gem which sinatra
ruby: No such file or directory -- gem (LoadError)

@chariotsofthegods

I have installed it. But I get the following.
ruby -s gem which sinatra
ruby: No such file or directory -- gem (LoadError)

@chariotsofthegods

WHa i I did was gem install sinatra. Is there anything else I should do?

@rkh
Member
rkh commented Mar 23, 2011

Nope. Sorry, has to be a large S: ruby -S gem .... What happens if you do a ruby -rubygems main.rb?

@chariotsofthegods

ruby -S gem which sinatra ERROR: Can't find ruby library file or shared library sinatra

ruby -rubygems main.rb
/home/jithesh/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require': no such file to load -- sinatra (LoadError) from /home/jithesh/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from main.rb:2:in `

'

Same error :(

@rkh
Member
rkh commented Mar 23, 2011

Yes, you don't have Sinatra installed. In #228, that is very unlikely to be your gem directory, since it is in /usr/local and not in /home/jithesh/.rvm and second, you use 1.9.2, the path in #228 says 1.9.1. Try gem list for your installed gems. Simply doing gem install sinatra should fix this.

@chariotsofthegods

Hi,
I tried what you suggested. But not working. :(

sudo gem install sinatra
[sudo] password for jithesh:
Successfully installed sinatra-1.2.1
1 gem installed
Installing ri documentation for sinatra-1.2.1...
Installing RDoc documentation for sinatra-1.2.1...
jithesh@jithesh-N150-N210-N220:$ cd ruby
jithesh@jithesh-N150-N210-N220:
/ruby$ ls
blog new reverse test.rb
jithesh@jithesh-N150-N210-N220:/ruby$ cd reverse
jithesh@jithesh-N150-N210-N220:
/ruby/reverse$ ruby main.rb
/home/jithesh/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require': no such file to load -- sinatra (LoadError) from /home/jithesh/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from main.rb:2:in `

'
jithesh@jithesh-N150-N210-N220:~/ruby/reverse$ gem list

*** LOCAL GEMS ***

@rkh
Member
rkh commented Mar 24, 2011

Try without the sudo. Also, what's the result of which gem? If you prefix it with ruby -S it ensures your currently active Ruby is chosen. The problem is definitely you having two different Ruby setups on the same machine. Hop into the #rvm channel on freenode for more help, possibly link to this ticket. A webchat is here.

@chariotsofthegods

Hey rkh,
Charm! yes, sudo ruby main.rb worked like charm! Thanks a lot...

@elfassy
elfassy commented Aug 24, 2012

Had the same problem, it was because i was inside a rails directory

@gac
gac commented Mar 20, 2013

you have to write this line at start

require 'rubygems'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment