I try to run a working rails project from OSX to Debian. I use on both systems RVM and created the same gemsets and rvmrc for the project. On Debian I installed only ruby with rvm no system installation of ruby exists.
when I jump in the project folder rvm is switching to version 1.8.7 and is using the project gemset everything looks fine.
But when I fire up a rake -T I get this error:
$ rake -T --trace
(in /home/i/project/src)
rake aborted!
uninitialized constant ActiveSupport::Dependencies::Mutex
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:55
/home/i/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/home/i/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/activesupport-2.3.5/lib/active_support.rb:56
/home/i/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/home/i/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rails-2.3.5/lib/tasks/misc.rake:18
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rails-2.3.5/lib/tasks/rails.rb:4:in `load'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rails-2.3.5/lib/tasks/rails.rb:4
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rails-2.3.5/lib/tasks/rails.rb:4:in `each'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rails-2.3.5/lib/tasks/rails.rb:4
/home/i/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/home/i/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/home/i/ws/project/src/Rakefile:10
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile'
/ home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rake-0.8.7/lib/rake.rb:2000:in `run'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rake-0.8.7/bin/rake:31
/home/i/.rvm/gems/ruby-1.8.7-p249#project/bin/rake:19:in `load'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/bin/rake:19
For me, adding require 'thread' didn't work either.
The problem was solved by downgrading rubygems to 1.4.2:
It's a compatibility issue between newer versions of rubygems (in my case, 1.8.5) and old versions of rails (in my case 2.3.5)
$ gem install rubygems-update -v='1.4.2'
$ gem uninstall rubygems-update -v='1.8.5'
$ update_rubygems
My working solution. Add the following line:
require 'thread'
At the first line of Rakefile in your rails project root. And magically all will run ;-)
I ran into this myself not too long ago. If you google for it you'll find a couple of blog and mailing list posts advising you to explicitly require "threads" in your environment.rb. However this did not work for me, but downgrading rubygems did:
sudo gem update --system 1.3.7
Some of the posts also mention upgrading to a newer version of Rails, which was not an option in our case at the moment.
you can solve it by upgrading rails
gem install rails --version 2.3.11
or downgrade gem
sudo gem update --system 1.5.3
Related
It seems that my ruby version auto updated to 2.0.0 after I upgraded my OSX to Yosemite.
It failed me when I tried to do
rake db:migrate
My application supports version 1.9.3 and I am uncertain that is the cause of such error.
$ rake db:migrate --trace
rake aborted! LoadError: cannot load such file -- iconv
/Users/jinqyu/Documents/Chocolicious/config/application.rb:5:in `require'
/Users/jinqyu/Documents/Chocolicious/config/application.rb:5:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Users/jinqyu/Documents/Chocolicious/Rakefile:4:in `<top (required)>'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:687:in `raw_load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:94:in `block in load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:93:in `load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:77:in `block in run'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/usr/bin/rake:37:in `<main>'
I found few links installing ruby 1.9.3 but I don't know which one to use.
I followed a guide from http://www.curvve.com/blog/guides/2013/install-ruby-1-9-3-mac-osx-10-8-macports-rvm/
However, I can't even run the first command
$sudo port selfupdate -v
after installing macPort. It says command not found.
Any ror warriors has the same problem as me and had solved it? Please help!
Downgraded ruby version to 1.9.3 and the app works fine! HOORAY!
So apparently the version is the cause of such error.
Here's the steps I took to resolve the error, open your terminal.
Install RVM with a Ruby, copy & paste:
$ \curl -sSL https://get.rvm.io | bash -s stable
$ rvm get head
Install Ruby
$ rvm use --install 1.9.3
Bundle install & rake:db
$ bundle install
$ rake db:migrate
Tell me if it solves your problem. I might missed out some steps after trying many other solutions that I found online.
p/s: you might have to install homebrew beforehand. cheers! :)
source: https://github.com/wayneeseguin/rvm/issues/3099
In order to resolve it, please add the following gem in the gem file, it would help you from being downgraded.
gem "iconv", "~> 1.0.3"
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.
I ran gem update --system thinking it would solve a problem I was having, and now I can't run rails server. It won't load and instead, I keep getting the following. Can someone tell me how to undo this and revert back to before I ran the update?
I've already ran git checkout, but the problem persists...
/usr/local/rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.5/lib/bundler/rubygems_integration.rb:187:in `stub_source_index170': uninitialized constant Gem::SourceIndex (NameError)
from /usr/local/rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.5/lib/bundler/rubygems_integration.rb:353:in `stub_rubygems'
from /usr/local/rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.5/lib/bundler/rubygems_integration.rb:250:in `replace_entrypoints'
from /usr/local/rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.5/lib/bundler/runtime.rb:14:in `setup'
from /usr/local/rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.5/lib/bundler.rb:107:in `setup'
from /usr/local/rvm/gems/ruby-1.9.3-p194#global/gems/rubygems-bundler-1.0.7/lib/rubygems-bundler/noexec.rb:66:in `setup'
from /usr/local/rvm/gems/ruby-1.9.3-p194#global/gems/rubygems-bundler-1.0.7/lib/rubygems-bundler/noexec.rb:78:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:110:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:35:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:9:in `<main>'
I had the same issue today. Updating bundler to the latest version fixed the problem:
gem update bundler
And if you are running rbenv
rbenv rehash
Seems like the latest version of Rubygems is buggy.
You just have to revert back to an older version with the following command and everything should work fine :
gem update --system 1.8.24
I'm installing gitorious on my webserver. Everything works fine except git-deamon, I get the following error when I run it
/etc/init.d/git-daemon start
Starting git-daemon: /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:31:in `setup':
You have already activated daemons 1.1.4, but your Gemfile requires daemons 1.1.0.
Consider using bundle exec. (Gem::LoadError)
from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:17:in `setup'
from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.18/lib/bundler.rb:107:in `setup'
from /var/www/gitorious/script/../config/../config/preinitializer.rb:16
from /var/www/gitorious/script/../config/boot.rb:28:in `load'
from /var/www/gitorious/script/../config/boot.rb:28:in `preinitialize'
from /var/www/gitorious/script/../config/boot.rb:10:in `boot!'
from /var/www/gitorious/script/../config/boot.rb:123
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
from /var/www/gitorious/script/../config/environment.rb:11
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
from /var/www/gitorious/script/git-daemon:11
failure
I have installed enterprise ruby 1.8.7 and ruby gems 1.4.2. I'm running ubuntu 11.04.
How could i solve it?
Thanks
The easy way (but not very future-proof):
gem uninstall daemons
cd /var/www/gitorious
bundle install
The hard way: modify /etc/init.d/git-daemon so that it runs cd /var/www/gitorious && bundle exec /var/www/gitorious/script/git-daemon start
I am trying to make this metric_fu get to work but I am getting a weird error.
braga#braga-laptop:~/prj/dummy_app$ rake metrics:all --trace
(in /home/braga/prj/dummy_app)
rake aborted!
RubyGem version error: chronic(0.6.2 not ~> 0.3.0)
/usr/local/lib/site_ruby/1.8/rubygems.rb:812:in `report_activate_error'
/usr/local/lib/site_ruby/1.8/rubygems.rb:223:in `activate'
/usr/local/lib/site_ruby/1.8/rubygems.rb:258:in `activate'
/usr/local/lib/site_ruby/1.8/rubygems.rb:257:in `each'
/usr/local/lib/site_ruby/1.8/rubygems.rb:257:in `activate'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:33:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:547:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in `require'
/home/braga/prj/dummy_app/Rakefile:12
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2000:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
In Rakefile line 12 all I have done is given require 'metric_fu'. I tried uninstalling the chronic gem. Installed separate versions of 0.3.0 and 0.6.2 in all combinations. But still I cannot run the metrics. Any help would be much appreciated.
The rails version and ruby versions I use are
braga#braga-laptop:~/prj/dummy_app$ rails --version
Rails 2.3.14
braga#braga-laptop:~/prj/dummy_app$ ruby --version
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]
Apparently, this is a known problem. Metric_fu is very obtrusive, meaning it does not run out of the box for a rails project. Iain has created an excellent gem called metrical which wraps metric_fu and takes care of all the dependencies. And the most exciting feature is, it totally runs independent from the project.
To quickly get up and running look at this wonderful railscast by Ryan.
I'm the new maintainer of metric_fu and it should work now on ruby 1.9 without any problems. See configuration instructions at https://github.com/metricfu/metric_fu which include how you can have metric_fu load external coverage output (e.g. using simplecov)
Also, it works from the command-line now. Now need to bundle it or run rake or metrical