Problems running rails 2.3.10 bundler `require': no such file to load -- rubygems (LoadError) - bundler

I have an app on Rails 2.3.10 on production; when I try to start with ruby script/server -p 3017 -e production -d it throws me the following error:
Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org
try installing passenger to start the project with but it generates another error:
/home/gmcms/.rvm/gems/ruby-1.8.7-p370#nick_backend/gems/bundler-1.3.5/lib/bundler/shared_helpers.rb:2:in `require': no such file to load -- rubygems (LoadError)
from /home/gmcms/.rvm/gems/ruby-1.8.7-p370#nick_backend/gems/bundler-1.3.5/lib/bundler/shared_helpers.rb:2
from /home/gmcms/.rvm/gems/ruby-1.8.7-p370#nick_backend/gems/bundler-1.3.5/lib/bundler/setup.rb:1:in `require'
from /home/gmcms/.rvm/gems/ruby-1.8.7-p370#nick_backend/gems/bundler-1.3.5/lib/bundler/setup.rb:1
I got this project from another developer, and he always started the project this way; before it didn't have a Gemfile, so I created a Gemfile where I defined the gems the project is using and then install everything with bundler adding the parameter --deployment:
bundle install --deployment
I've also followed the steps that are on the official website of bundler:
http://bundler.io/v1.3/rails23.html
But when I try to run the project the same way using ruby script/server it haves me the same error. I followed this threads but none of them worked for me:
http://docs.rubygems.org/read/chapter/15#page66
Rails "no such file to load -- rubygems (LoadError)"
no such file to load -- rubygems (LoadError)
What can I do? Thanks in advance.
Juan Trejo.

I have run into similar issues. Try running
rvm gemset use global && bundle

Related

Ruby - Can't require gem properly

I'm trying to require the gem 'cerebrum'. I tried requiring it using the irb, and that worked, and also running the program in JRuby worked too. However, Ruby throws a LoadError.
C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- cerebrum (LoadError)
from C:/Ruby23-x64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
What am I doing wrong? Has anyone had that issue too?
You get the load error when gem is not installed. First check if this gem is installed in this ruby version using gem list cerebrum. It may be installed in your jruby that's why it didn't throw error.

ruby - require 'pg' not working on OSX

(This has got to be a UFU)
Simple piece of code:
#!/usr/bin/ruby
require 'pg'
# use postgres
Then I run:
(shell)> gem install pg
It says:
gem install pg
Building native extensions. This could take a while...
Successfully installed pg-0.18.1
invalid options: -f fivefish
(invalid options are ignored)
Parsing documentation for pg-0.18.1
Done installing documentation for pg after 1 seconds
1 gem installed
Now I run my app:
(shell)>./update.rb
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- pg (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
from ./update.rb:3:in `'
I've tried using a Gemfile/bundle install too - same result.
I'm doing something foolish here - just can't seem to see it.
Edit:
postgres is installed:
postgres --version
postgres (PostgreSQL) 9.4.1
Edit:
Tried the same setup on a CentOS 6.5 machine. Same result(s). Clearly I'm missing some major step / component.
May be your installation of pg is not belongs to /usr/, may be /usr/local or somewhere else.

shotgun gem bug 'cannot load such file -- thin'

I'm using shotgun to serve my Sinatra project on Ubuntu development machine. And when I'm starting shotgun with -d (debug), it returns me
Exception `LoadError' at /home/askhat/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- thin
Exception `LoadError' at /home/askhat/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/resolv.rb:169 - LoadError
But thin gem is installed. Actually shotgun works properly with this error. There is no problem, just interesting why it's appends?
do you have a Gemfile in your app? usually it should be enough to add thin to Gemfile as RVM uses rubygems-bundler gem which automatically assumes bundle exec context for binaries that are installed from gems via Gemfile.

Installing a gem has no effect (aka how to use check_puppet.rb)

I'm sure this question is an easy one for Ruby users. However for me this is a issue I can't figure out by myself.
My goal is to use a script included in the Puppet archive (ext/nagios/check_puppet.rb) on a Ubuntu-10.4 system.
I try to launch the script:
$ sudo ./check_puppet.rb
./check_puppet.rb:4:in `require': no such file to load -- sys/proctable (LoadError)
from ./check_puppet.rb:4
Ok so there's something missing. I fount out I need some library called sys-proctable available at http://raa.ruby-lang.org/project/sys-proctable/
wget http://rubyforge.org/frs/download.php/65609/sys-proctable-0.9.0-x86-linux.gem
[...]
sudo apt-get install rubygems
[...]
$ sudo gem install sys-proctable-0.9.0-x86-linux.gem
Successfully installed sys-proctable-0.9.0-x86-linux
1 gem installed
Installing ri documentation for sys-proctable-0.9.0-x86-linux...
Installing RDoc documentation for sys-proctable-0.9.0-x86-linux...
Everything looks pretty good so far! Time to launch the script again
$ sudo ./check_puppet.rb
./check_puppet.rb:4:in `require': no such file to load -- sys/proctable (LoadError)
from ./check_puppet.rb:4
the gem listoutput tells me this:
$ gem list
*** LOCAL GEMS ***
sys-proctable (0.9.0)
Where has this gem been installed?
Why can't the script load the sys-proctable lib?
What the %&$# am I doing wrong?
Where's the official doc of gem?
The gem is installed - but in Ruby 1.8 you need to have the line:
require 'rubygems'
To use rubygems. This changes the 'require' function so it will pull in rubygems when you ask it to.
So in the script:
https://github.com/puppetlabs/puppet/blob/master/ext/nagios/check_puppet.rb
Just add the require near the top and try again.
For instructions on other ways to use rubygems, consult the Rubygems documentation:
http://docs.rubygems.org/read/chapter/3#page70
this is what i am getting on centos 6.4
sudo ./check_puppet.rb
./check_puppet.rb:75:in `-': no implicit conversion to float from nil (TypeError)
from ./check_puppet.rb:75:in `check_state'
from ./check_puppet.rb:122
i added require 'rubygems'
and installed sys-proctable

Including gems in ubuntu 11.04

I've got a problem with running an additional gem under ubuntu 11.04. I installed spiceweasel via gem install - which put it in /var/lib/gems/1.8/gems/spiceweasel. When I try to run it, I get:
`require': no such file to load -- spiceweasel/version (LoadError)
The file is in /var/lib/gems/1.8/gems/spiceweasel-0.7.1/lib/spiceweasel/version.rb but cannot be loaded. This happens both with and without -rubygems.
How do I fix this?
It seems to be the same problem like here: Ruby: require 'irbtools' raises LoadError
The gem author published the gem with wrong permissions. You should contact the gem author.

Resources