I am having a problem getting an old Ruby on Rails 2 app that hasn't worked in a year to work.
I'm trying to run rake test:functionals in the root of my project directory, but am getting undefined method 'name' for "SystemTimer":String.
I've pasted everything that I believe relevant to the problem here:
http://pastebin.com/NgBvystZ
Also, when I run rake itself, I get
Errors running test:units!
Not sure how to debug that.
I have copied and pasted everything that I think would be useful to understanding this problem. Your time is greatly appreciated. Thank you.
This is an incompatibility between versions of RubyGems greater than 1.3.7 and versions of Rails less than 2.3.12. There are a few ways to solve this.
Use Bundler
Bundler is easy to install, fixes this problem, and has a number of other advantages as well. I highly recommend it.
Upgrade to Rails 2.3.12 or higher
Rails 2.3.12 fixed compatibility issues with RubyGems 1.8.5 (see release report).
Downgrade to RubyGems 1.3.7
I would not recommended this unless you have no other choice. Use this command: gem update --system 1.3.7. Also, version 1.7.2 has partial compatibility (it will run, but freezing gems will fail and there are likely other issues).
I chanced upon this thread, because I got the following error when migrating some Radiant 0.9.1 installations to a new server:
undefined method `name' for "RedCloth":String
(3) The compromising solution: I haven't tested this personally, but I hear that rails 2.3 with bundler is compatible with the latest rubygems. If you're interested in this solution, see http://gembundler.com/rails23.html for getting bundler to work under rails 2.3.
For me solution 3 was the only option, since we had other apps needing the latest rubygems on the system.
Just install bundler and follow thes steps on this page:
http://gembundler.com/rails23.html
And put this in a file called "Gemfile" in the app root:
source :gemcutter
gem "radiant", "0.9.1"
gem "sanitize"
gem "fastercsv"
gem "rmagick"
gem "rack", "~> 1.1.0"
gem "rake", ">= 0.8.3"
gem "RedCloth", ">= 4.0.0"
gem "will_paginate", "~> 2.3.11"
gem "mysql"
This is just my example. Start with only the first 2 lines, run bundle update and reload the page to see what else you might be missing.
Thank you Ben!
Related
I'm working on a new project in Ruby, which I'm learning, and I need to install Sinatra gem and I'm getting the following error:
"Following gems were not installed: sinatra-sinatra (0.10.1): While
executing gem ... (Gem::UnsatisfiableDependencyError)
Unable to resolve dependency: 'sinatra-sinatra (= 0.10.1)' requires 'rack (>= 1.0)'"
Currently I'm using, RubyMine (Windows). Any help would be appreciated.
Thanks
The problem is not RubyMine, but some other dependency conflict in your app. The gem sinatra-sinatra requires Rack 1.0, there is probably another gem in your Gemfile that requires a greater or different version of the same gem.
Actually, I believe your problem can easily be fixed by using the proper gem. sinatra-sinatra is a very old gem, if you want to use the Sinatra framework the correct gem is sinatra. Update your Gemfile accordingly.
In you machine
gem install sinatra-sinatra
Check you Gemfile
gem 'sinatra-sinatra', '~> 0.10.1'
Delete the Gemfile.lock and bundle its once again.
ruby version is 2.1.0 and rails version is 4.1.1
my gem file got like below
gem 'debugger'
when i run command bundle install, i get error like below:
##
An error occurred while installing debugger (1.6.8), and Bundler cannot continue.
Make sure that gem install debugger -v '1.6.8' succeeds before bundling.
##
seeking suggestion to solve the issue.
debugger isn't compatible with Ruby 2 and above, it's a known issue.
https://github.com/cldwalker/debugger/issues/125#issuecomment-43353446
The author recommends using byebug or debugger2 instead.
This Worked for me:
Please replace
gem 'pry-debugger'
with
gem 'pry-byebug'
Thanks!
Debugger is not fully supported for Ruby 2.x.x.
Issue#118 is popular issue which addresses the same. Though it mentions that debugger 1.6.6 must be supported by Ruby 2.1.1, the users are still encountering the similar errors as you are.
Also, this is especially mentioned in their known issues.
You can try to follow that discussion to troubleshoot your problem.
Additionally, this may help:
rm Gemfile.lock
gem install debugger-ruby_core_source
gem update
bundle install
The other solution in issue discusses the possibility of updating Ruby binary.
If nothing works, and if you can possibly change the ruby/rails versions, I can suggest my current combination:
ruby 2.0.0-p195
rails 4.0.0
They work perfectly fine with debugger gem.
debugger gem doesn't work with Ruby 2.1+. Instead try byebug.
I have had a lot of difficulty installing Gems into my Rails 4 Apps that I have built. For example, I have recently had issues with these two Gems:
Ckeditor:
https://github.com/galetahub/ckeditor
Twitter Bootstrap 3:
https://github.com/twbs/bootstrap-sass
I have no idea what I am doing wrong, in the slightest. I include the gems in my Gem file (gem 'ckeditor_rails'), and then I run 'bundle install'. However, whenever I provide my includes in my application.js (example: '//= require ckeditor/init'), my app yells at me and tells me that it cannot resolve the file. When I check why, its because no file was ever downloaded. Even though the gem installed with no errors. I have got to think I am doing something wrong. Any advice?
Before installing gem, first noted if there is any dependency gem. if the gem having dependency gem means you must install it first. and you may edit in your project/gem file gem 'ckeditor' and gem 'bootstrap-sass' and then run the server.
I have updated all of my gems, including to Rails 3.2.8, prior to a new deployment. However, my application is now broken because something is trying to install gem "termios" version 0.9.4.
Apparently, 0.9.4 does not work on any computer or server I own. There are some newer versions, 0.9.6 specifically, but they are not posted in wherever bundler looks for gems.
There are some version on Github, but they have been mysteriously renamed "ruby-termios". Well, some gem in my Gemfile is not looking for ruby-termios. It's looking for termios. Failure.
How can I find out which gem is trying to install this so I can see if it can be whacked?
Check your Gemfile.lock - it has all the gems and their dependencies listed in it. As long as you've been able to install these gems in the past, you'll be able to tell where that dependency is coming from.
The gem command will dump out the tree of dependencies for you.
$ gem dependency
Or if you want to check just a specific gem.
$ gem dependency foo
I'm using the thumbs_up gem and on github there's a master branch (0.4.6) and an engine branch (0.3.2). When I require the gem in my Gemfile with
gem 'thumbs_up'
I see that version 0.4.6 was installed. I verify this is the right version running in my dev environment by doing bundle exec gem which thumbs_up and when I look at the VERSION file I see it's 0.4.6.
So when I look at the code I'm expecting to find an unvote_for method but it doesn't have one. Instead it has one called clear_votes. Now I'm confused because clear_votes is supposed to be in version 0.3.2 but as far as I can tell, I'm on version 0.4.6.
Any ideas what's going on here?
By default, the gem used is the latest available when running 'bundle install'. You can specify a version (or version constraints) in the Gemfile. To update the version of the gem used, you have to run bundle update <gemname>, and it will do so according to your gemfile.
About your problem : ensure that your server/console command is prefixed with bundle exec. You check also which versions of thumbs_up are installer on your system, and remove the version you don't need anymore.
You use Bundler so you can know which version of you gem is using in your Gemfile.lock. Bundler have and use only one version by gem.