Gem_original_require ': no ​​such file to load - sinatra (LoadError)

I am working on my local machine. If I use the Sinatra application, I have no problem adding this line to myapp.rb

require 'sinatra' 

When I go to the console and run

 irb -r myapp.rb 

I get this error

 gem_original_require': no such file to load -- sinatra (LoadError) 

I understand that either my IRB or Ruby path does not look right. Am I using (Simple Ruby Version Management: rbenv) to manage my Ruby environment not too confidently if this affects things? I ran gem env and I got this.

 RubyGems Environment: - RUBYGEMS VERSION: 1.8.10 - RUBY VERSION: 1.9.2 (2011-07-09 patchlevel 290) [x86_64-darwin11.0.1] - INSTALLATION DIRECTORY: /Users/Air/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1 - RUBY EXECUTABLE: /Users/Air/.rbenv/versions/1.9.2-p290/bin/ruby - EXECUTABLE DIRECTORY: /Users/Air/.rbenv/versions/1.9.2-p290/bin - RUBYGEMS PLATFORMS: - ruby - x86_64-darwin-11 - GEM PATHS: - /Users/Air/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1 - /Users/Air/.gem/ruby/1.9.1 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - http://rubygems.org/ 
+4
source share
2 answers

Try:

 irb -r ./myapp.rb 

If you are using the config.ru file, this path should also be reflected.

+2
source

In my case, I used rvm. Despite the fact that I configured the .rvmrc file and assured that I was using the correct gemset with the installed sinatra, I continued to have the same error.

Then I tried to install the sinatra in my native version of Ruby:

 gem install sinatra 

I had to install the sqlite adapter also for the sinatra application that I was trying to run:

 gem install sqlite3 

Finally, I had to start a lean blog ( https://github.com/rodrigomes/scanty ) with

 ruby main.rb 

It worked, but I don't think this is the best solution.

+2
source

Source: https://habr.com/ru/post/1383265/


All Articles