Cannot run "ruby script/server" rails/version (LoadError) - ruby-on-rails

I am facing a problem starting the server for a ruby app built by somebody else. When I run the "ruby server/script" command, the following output is generated:
ruby script/server
./script/../config/../vendor/rails/railties/lib/initializer.rb:7:in `require': no such file to load -- rails/version (LoadError)
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:7
from ./script/../config/boot.rb:45:in `require'
from ./script/../config/boot.rb:45:in `load_initializer'
from ./script/../config/boot.rb:38:in `run'
from ./script/../config/boot.rb:11:in `boot!'
from ./script/../config/boot.rb:109
from script/server:2:in `require'
from script/server:2
I have looked, and looked and no solution seems in sight.
Specs:
Ruby 1.8.7,
Rails 2.2.2,
gem -v 1.8.25
EDIT:
After doing that, I still get the same error:
[dralexmv#archbang rubygame]$ ruby script/server
./script/../config/../vendor/rails/railties/lib/initializer.rb:7:in `require': no such file to load -- rails/version (LoadError)
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:7
Versions:
[dralexmv#archbang rubygame]$ gem -v
1.4.2
[dralexmv#archbang rubygame]$ rails -v
Rails 2.2.2
[dralexmv#archbang rubygame]$ ruby -v
ruby 1.8.7 (2012-10-12 patchlevel 371) [x86_64-linux]
EDIT: GEM LIST
*** LOCAL GEMS ***
actionmailer (2.2.2)
actionpack (2.2.2)
activerecord (2.2.2)
activeresource (2.2.2)
activesupport (2.2.2)
bundler (1.2.4)
json (1.7.7)
mysql (2.9.1)
rails (2.2.2)
rake (10.0.3)
rdoc (4.0.0)
rubygems-bundler (1.1.0)
rubygems-update (1.4.2)
rvm (1.11.3.6)
sqlite3 (1.3.7)
EDIT: Test on a test app
[dralexmv#archbang test_a]$ ruby script/server
=> Booting WEBrick...
=> Rails 2.2.2 application started on `http://0.0.0.0:3000`
=> Ctrl-C to shutdown server; call with --help for options
[2013-03-10 12:06:35] INFO WEBrick 1.3.1
[2013-03-10 12:06:35] INFO ruby 1.8.7 (2012-10-12) [x86_64-linux]
[2013-03-10 12:06:35] INFO WEBrick::HTTPServer#start: pid=11230 port=3000

Downgrade your gem and try. Rails 2.X doesn't work with gem version greater than 1.5
sudo gem update --system 1.4.2

Related

Bundler doesn't work although it is installed as a local gem

I try installing Redmine (that means ruby and rails) on my OFFLINE ubuntu 14.04.
I installed ruby OK, compiling from source:
$ ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
I installed bundler, creating the gem thanks to rake and then installing the gem:
$ gem list
*** LOCAL GEMS ***
bigdecimal (default: 1.3.0)
bundler (2.0.0.dev)
did_you_mean (1.1.0)
io-console (default: 0.4.6)
json (default: 2.0.2)
minitest (5.10.1)
net-telnet (0.1.1)
openssl (default: 2.0.3)
power_assert (0.4.1)
psych (default: 2.2.2)
rake (12.0.0)
rdoc (default: 5.0.0)
test-unit (3.2.3)
xmlrpc (0.2.1)
I then want to install downloaded gems locally, but bundler doesn't seem to be installed. When I check, it is apparently the case:
$ bundle -v
/usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler (LoadError)
from /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/gems/2.4.0/gems/bundler-2.0.0.dev/exe/bundle:10:in `<top (required)>'
from /usr/bin/bundle:22:in `load'
from /usr/bin/bundle:22:in `<main>'
How can I solve this?
Thanks a lot
César

Running RoR2 application via unicorn or thin gives gem missing error

Hullo,
The following issue has really been bothering me much of late. I haven't been able to figure out exactly why it exists.
I have a Rails 2 application, specifically Rails 2.3.5, built that I am trying to deploy on a development machine running Ubuntu 10.10. I have set up everything properly, to the best of my knowledge. Here's some proof:
ayaz#ubuntu$ rails -v
Rails 2.3.5
ayaz#ubuntu$ gem -v
1.3.7
ayaz#ubuntu$ ruby -v
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]
ayaz#ubuntu$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /var/lib/gems/1.8
- /home/ayaz/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
ayaz#ubuntu$ gem list
*** LOCAL GEMS ***
actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
atomic (1.1.10)
daemons (1.1.9)
eventmachine (1.0.3)
i18n (0.6.4)
kgio (2.8.0)
minitest (4.7.5)
multi_json (1.7.7)
rack (1.5.2, 1.0.1)
rails (2.3.5)
raindrops (0.11.0)
rake (10.1.0)
thin (1.5.1)
thread_safe (0.1.2)
tzinfo (0.3.37)
unicorn (4.6.3)
If I run the application via script/server, it runs fine:
ayaz#ubuntu$ script/server
=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-07-28 01:10:37] INFO WEBrick 1.3.1
[2013-07-28 01:10:37] INFO ruby 1.8.7 (2010-06-23) [i686-linux]
However, if I run it, say, via unicorn or thin, I keep getting this gem error:
ayaz#ubuntu$ thin start
>> Using rails adapter
Missing the Rails 2.3.5 gem. Please `gem install -v=2.3.5 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.
unicorn_rails gives the same error. Now, I've looked around and found suggestions about adding a require "rubygems" beforehand. I have tried it: I have added the line at the top of config/boot.rb as well as config/environment.rb, but to no avail.
Would anyone be kind enough to point me in the right direction, please?
Thanks much!
I would expect that you have multiple versions of ruby/rubygems running (via RVM or rbenv for example). This might help you determine which ruby is actually used:
which ruby
which gem

RVM installation ruby 1.8.7 and rails 2.3.4 Could not find gem 'rails (= 1.8.7) ruby' in the gems available on this machine. (Bundler::GemNotFound)

I need to install ruby 1.8.7 and rails 2.3.4 because I need to modify an old application.
(latest ruby and gems in RVM working for me fine, but I need to use this old gems and ruby)
//runing ubuntu 12.04
problem is when i try to run rake gems:install
(and I cannot do rails new app also)
I cannot solve this and I do not have much time.
Thanks in advance for any help.
$ rvm use 1.8.7
Using /home/user/.rvm/gems/ruby-1.8.7-p370
$ rvm gemset use gemset234
Using ruby-1.8.7-p370 with gemset gemset234
$ gem list
* LOCAL GEMS *
actionmailer (2.3.4)
actionpack (2.3.4)
activerecord (2.3.4)
activeresource (2.3.4)
activesupport (2.3.4)
bundler (1.1.5, 0.9.1)
rack (1.0.1)
rails (2.3.4)
rake (0.9.2.2, 0.8.7)
rubygems-bundler (1.0.3)
rubygems-update (1.8.24)
rvm (1.11.3.5)
$ rake gems:install
/home/user/.rvm/gems/ruby-1.8.7-p370#gemset234/gems/bundler-1.1.5/lib/bundler/resolver.rb:287:in `resolve': Could not find gem 'rails (= 1.8.7) ruby' in the gems available on this machine. (Bundler::GemNotFound)
from /home/user/.rvm/gems/ruby-1.8.7-p370#gemset234/gems/bundler-1.1.5/lib/bundler/resolver.rb:161:in `start'
from /home/user/.rvm/gems/ruby-1.8.7-p370#gemset234/gems/bundler-1.1.5/lib/bundler/resolver.rb:128:in `resolve'
from /home/user/.rvm/gems/ruby-1.8.7-p370#gemset234/gems/bundler-1.1.5/lib/bundler/resolver.rb:127:in `catch'
from /home/user/.rvm/gems/ruby-1.8.7-p370#gemset234/gems/bundler-1.1.5/lib/bundler/resolver.rb:127:in `resolve'
from /home/user/.rvm/gems/ruby-1.8.7-p370#gemset234/gems/bundler-1.1.5/lib/bundler/definition.rb:192:in `resolve'
from /home/user/.rvm/gems/ruby-1.8.7-p370#gemset234/gems/bundler-1.1.5/lib/bundler/definition.rb:127:in `specs'
from /home/user/.rvm/gems/ruby-1.8.7-p370#gemset234/gems/bundler-1.1.5/lib/bundler/environment.rb:27:in `specs'
from /home/user/.rvm/gems/ruby-1.8.7-p370#global/gems/rubygems-bundler-1.0.3/lib/rubygems-bundler/noexec.rb:41:in `candidate?'
from /home/user/.rvm/gems/ruby-1.8.7-p370#global/gems/rubygems-bundler-1.0.3/lib/rubygems-bundler/noexec.rb:60:in `setup'
from /home/user/.rvm/gems/ruby-1.8.7-p370#global/gems/rubygems-bundler-1.0.3/lib/rubygems-bundler/noexec.rb:75
from /home/user/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:60:in `gem_original_require'
from /home/user/.rvm/rubies/ruby-1.8.7-p370/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:60:in `require'
from /home/user/.rvm/gems/ruby-1.8.7-p370#gemset234/bin/ruby_noexec_wrapper:9
This is a drawback to the gem installation system in rails 2. If there is a dependency required for rake to run, like rails in this case, you will need to install it manually. Do gem install for each of these dependencies until rake finally runs.

undefined method `cattr_accessor' for RailsUpgrade::Upgraders::RouteRedrawer:Class

I was upgrading a Rails 2 application to Rails 3.
Then I installed rails-upgrade gem:
$ gem install rails-upgrade --user-install
Fetching: rails-upgrade-0.0.2.gem (100%)
PostInstall.txt
Successfully installed rails-upgrade-0.0.2
1 gem installed
Installing ri documentation for rails-upgrade-0.0.2...
Installing RDoc documentation for rails-upgrade-0.0.2...
And then I ran check, but it raise this error:
$ rails-upgrade check
/home/neoriddle/.gem/ruby/1.8/gems/rails-upgrade-0.0.2/lib/rails-upgrade/upgraders/routes.rb:28: undefined method `cattr_accessor' for RailsUpgrade::Upgraders::RouteRedrawer:Class (NoMethodError)
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:55:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:55:in `require'
from /home/neoriddle/.gem/ruby/1.8/gems/rails-upgrade-0.0.2/lib/rails-upgrade.rb:12
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:55:in `gem_original_require'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:55:in `require'
from /home/neoriddle/.gem/ruby/1.8/gems/rails-upgrade-0.0.2/bin/rails-upgrade:7
from /home/neoriddle/.gem/ruby/1.8/bin/rails-upgrade:19:in `load'
from /home/neoriddle/.gem/ruby/1.8/bin/rails-upgrade:19
What is wrong and how can I solve it?
I have installed Rails 3 and all dependencies required:
$ rails -v
Rails 3.0.9
$ ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-linux]
$ gem list active
*** LOCAL GEMS ***
active_scaffold_vho (3.0.20)
activemerchant (1.15.0, 1.14.0)
activemodel (3.0.9, 3.0.7, 3.0.5, 3.0.3)
activerecord (3.0.9, 3.0.7, 3.0.3, 2.3.11, 2.3.5, 2.2.3, 2.1.2, 2.1.1, 2.0.5, 1.15.3)
activeresource (3.0.9, 3.0.7, 3.0.3, 2.3.11, 2.3.5, 2.2.3, 2.1.2, 2.1.1)
activesupport (3.0.9, 3.0.7, 3.0.5, 3.0.3, 2.3.11, 2.3.5, 2.2.3, 2.1.2, 2.1.1, 2.0.5, 1.4.2)
$ gem list action
*** LOCAL GEMS ***
actionmailer (3.0.9, 3.0.7, 3.0.3, 2.3.11, 2.3.5, 2.2.3, 2.1.2, 2.1.1, 1.3.3)
actionpack (3.0.9, 3.0.7, 3.0.3, 2.3.11, 2.3.5, 2.2.3, 2.1.2, 2.1.1, 1.13.3)
actionwebservice (1.2.6, 1.2.3)
If you need more infor please ask me.
I don't think this gem has been updated to be compatible with Rails 3. The only other alternative is grabbing yourself a copy of the Rails 3 Upgrade Handbook and using that to go through the upgrade process.
I wrote a blog post about upgrading a Rails 2 application to Rails 3 here: http://ryanbigg.com/2010/11/the-rails-3-upgrade/.

Gem::RemoteFetcher::FetchErro when installing rails

I am trying to install rails on Ubuntu 8.10, and met following errors. Please help me get through.Thanks.
root#pierr-desktop:~# gem install rails
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
bad response 500 (http://gems.rubyforge.vm.bytemark.co.uk/gems/actionpack-2.3.4.gem)
#other information
root#pierr-desktop:~# ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
root#pierr-desktop:~# gem -v
1.2.0
root#pierr-desktop:~# gem list
*** LOCAL GEMS ***
activerecord (2.3.4)
activesupport (2.3.4, 1.4.4)
daemons (1.0.10)
gem_plugin (0.2.3)
rack (1.0.1)
rake (0.8.7, 0.8.3)
wirble (0.1.3)
You might just have to try again.
Looks like the server returned an error 500 which seems to be intermittent.

Resources