Unable to install passenger module - ruby-on-rails

I am trying to configure the passenger and Nginx for rails application .
I am getting compilation error while execute the passenger command.
Ruby version :
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
Rails version
Rails 4.2.6
Error message:-
# passenger-install-nginx-module
/usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/specification.rb:2158:in `method_missing': undefined method `this' for #<Gem::Specification:0x7cab3c passenger-5.0.28> (NoMethodError)
from /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/specification.rb:1057:in `find_active_stub_by_path'
from /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:64:in `require'
from /usr/local/rvm/gems/ruby-2.3.1/gems/passenger-5.0.28/bin/passenger-install-nginx-module:33:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.3.1/bin/passenger-install-nginx-module:23:in `load'
from /usr/local/rvm/gems/ruby-2.3.1/bin/passenger-install-nginx-module:23:in `<main>'
from /usr/local/rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
from /usr/local/rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'
could you please help me on this matter.

If not resolved yet, you can try:
gem update --system
and then try to compile again.

This works in my case:
Remove ruby and rvm - then Reinstall. Try again.

Related

error during installing ruby on rails application uninitialized constant Gem::BasicSpecification (NameError)

I am trying to install ruby on rails application fedena on Ubuntu server.
It uses some old ruby library. I followed the instructions on
http://paritosh.passion8.co.in/post/49878771105/fedena-installation-guide
gem install rubygems-update -v=1.3.7
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:43:in `<top (required)>': uninitialized constant Gem::BasicSpecification (NameError)
from /usr/local/lib/site_ruby/2.3.0/rubygems.rb:1113:in `require'
from /usr/local/lib/site_ruby/2.3.0/rubygems.rb:1113:in `<top (required)>'
from <internal:gem_prelude>:4:in `require'
from <internal:gem_prelude>:4:in `<internal:gem_prelude>'
If you are using RVM, then run
rvm install rubygems 1.3.7
this worked for me

heroku login gives undefined method 'remove' for QuickLoader module

I am a newbiw trying to walk through rails tutorials by Michael Hartl. I upgraded Ruby and Rails recently. I am able to launch a dummy application and push it to git. However, when I try to login to heroku, it fails with below error
$ heroku login
/Users/krishnabhat/.rvm/gems/ruby-2.0.0-p481#railstutorial_rails_4_0/gems/rubygems-update-2.3.0/lib/rubygems/compatibility.rb:19:in `<top (required)>': undefined method `remove' for Gem::QuickLoader:Module (NoMethodError)
from /Users/krishnabhat/.rvm/gems/ruby-2.0.0-p481#railstutorial_rails_4_0/gems/rubygems-update-2.3.0/lib/rubygems.rb:15:in `require'
from /Users/krishnabhat/.rvm/gems/ruby-2.0.0-p481#railstutorial_rails_4_0/gems/rubygems-update-2.3.0/lib/rubygems.rb:15:in `<top (required)>'
from <internal:gem_prelude>:158:in `require'
from <internal:gem_prelude>:158:in `load_full_rubygems_library'
from <internal:gem_prelude>:212:in `push_gem_version_on_load_path'
from <internal:gem_prelude>:16:in `gem'
from /usr/local/bin/heroku:18:in `<main>'
$ bundle -v
Bundler version 1.6.2
$ gem -v
2.3.0
$ ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [x86_64-darwin13.1.0]
Please assist.
Thanks
K

Bundler fails with Rbenv

I have inherited a rails 2.3.2 application and got it to work using ruby 1.8.7 under rbenv including some old versions of other gems and software.
Now I have generated a Gemfile and try to verify it by runing any bundle comand on it, e.g. bundle check, install, etc. but any of these operations fail. I installed the rbenv bundler plugin which makes it look a little lesss severe but I still can't figure it out.
$ bundle -V
/usr/local/lib/site_ruby/1.9.1/rubygems.rb:846: Use RbConfig instead of obsolete and deprecated Config.
/usr/lib/ruby/vendor_ruby/bundler/rubygems_integration.rb:310:in `<module:Bundler>': uninitialized constant Gem::VERSION (NameError)
from /usr/lib/ruby/vendor_ruby/bundler/rubygems_integration.rb:1:in `<top (required)>'
from /usr/lib/ruby/vendor_ruby/bundler.rb:12:in `require'
from /usr/lib/ruby/vendor_ruby/bundler.rb:12:in `<top (required)>'
from /usr/bin/bundle:4:in `require'
from /usr/bin/bundle:4:in `<main>'
My bundler installation:
$ which bundle
/usr/bin/bundle
Ruby:
$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]
Rbenv gives me problems too now:
$ rbenv alternatives
Skipping 1.8.7-debian, it already exists
/usr/local/lib/site_ruby/1.9.1/rubygems.rb:846: Use RbConfig instead of obsolete and deprecated Config.
Skipping 1.9.3-debian, it already exists
Isn't there supposed to be a shim for bundler? It seems that bundler is called directly.
I am lost. If anyone could help me with this I would be glad.
p.s.: I also just discovered this:
$ rbenv rehash
/usr/local/lib/site_ruby/1.9.1/rubygems.rb:846: Use RbConfig instead of obsolete and deprecated Config.
/usr/lib/ruby/vendor_ruby/bundler/rubygems_integration.rb:310:in `<module:Bundler>': uninitialized constant Gem::VERSION (NameError)
from /usr/lib/ruby/vendor_ruby/bundler/rubygems_integration.rb:1:in `<top (required)>'
from /usr/lib/ruby/vendor_ruby/bundler.rb:12:in `require'
from /usr/lib/ruby/vendor_ruby/bundler.rb:12:in `<top (required)>'
from /home/bernhard/.rbenv/plugins/bundler/etc/rbenv.d/bundler/rehash.rb:361:in `require'
from /home/bernhard/.rbenv/plugins/bundler/etc/rbenv.d/bundler/rehash.rb:361:in `require_and_patch_bundler'
from /home/bernhard/.rbenv/plugins/bundler/etc/rbenv.d/bundler/rehash.rb:427:in `<main>'
cat: /home/bernhard/.rbenv/plugins/bundler/share/rbenv/bundler/manifest.txt: No such file or directory

Having Trouble Generating a Ruby Migration

I wanted to generate a new migration for a site running Rails 2.3.14 and Ruby 1.8.7. I wrote the command
ruby script/generate migration AssetTable
Expecting the script to generate a file 20130522161112_asset_table.rb in the db/migrate directory. But I don't see this file. The output I get after running the above command is:
/var/lib/gems/1.8/gems/rails-2.3.14/lib/rails/gem_dependency.rb:81:in `add_load_paths': undefined method `requirement' for #<Rails::GemDependency:0x7ffd183eba58> (NoMethodError)
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:301:in `add_gem_load_paths'
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:301:in `each'
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:301:in `add_gem_load_paths'
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:132:in `process'
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:113:in `send'
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:113:in `run'
from /var/www/pbcore/releases/20120416101734/config/environment.rb:17
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/commands/generate.rb:1
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require
Does anyone know what I'm doing wrong here?
Depending on your rubygems versions, can you try to run:
$ gem install rubygems-update -v='1.4.2'
$ gem uninstall rubygems-update -v='1.5.0'
$ update_rubygems
Seen here: Gem dependency error in rails 2.3.4 :
This is happening because you installed RubyGems that is too new for
your version of Rails. Either downgrade (and re-run update_rubygems)
or upgrade Rails to 2.3.11.

Problems running rails server

I just installed the rails env using the Rails installer on my Mac OSX 10.7.4.
I create a project using the "rails new" command.
When I try to run the "rails server" command I get this message:
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/rails_generator/options.rb:32:in `default_options': undefined method `write_inheritable_attribute' for Rails::Generator::Base:Class (NoMethodError)
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/rails_generator/base.rb:90:in `<class:Base>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/rails_generator/base.rb:85:in `<module:Generator>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/rails_generator/base.rb:48:in `<module:Rails>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/rails_generator/base.rb:6:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/rails_generator.rb:37:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/bin/rails:15:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/rails:23:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/rails:23:in `<main>'
When I run the $ ruby -v and $ gem -v, I get "ruby 1.9.3p194" and "1.8.24" respectively. What am I missing here? How can I get this server to run?
It looks like you are trying to use a Rails 3.x command with Rails 2.3. Pre 3.0 you have to use the server script.
From within your application directory run:
./script/server
Install rails as a gem, gem install rails . As your are using rvm, the folder path displayed here shows rails 2.3.4, while you tried to run rails server . Check/change the rails version in your gem file and then do bundle install.

Resources