when I run any rails specific command in the console it gives me an error. For instance, i tried
rails -v then it gives me error
/usr/local/lib/ruby/1.9.1/x86_64-linux/rbconfig.rb:194:in `each': rehash occurred during iteration (RuntimeError)
from /usr/local/lib/ruby/1.9.1/x86_64-linux/rbconfig.rb:194:in `<module:RbConfig>'
from /usr/local/lib/ruby/1.9.1/x86_64-linux/rbconfig.rb:5:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:31:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/local/bin/rails:9:in `<main>'
The same happens for gem commands. Ruby is working fine.
Please Help. Thanks in Advance.
Not sure if that is the problem but according to the rails website, they only support ruby 1.8.7 or 1.9.2 .
and it seems you got 1.9.1.
The error message is showing that when you run rails, it is using 1.9.1. Per Wissam's comment, not sure if the ruby version is the problem, but you definitely need to make sure you are running on 1.9.2 before troubleshooting any further.
Did you install RVM? If so, have you set the default ruby? Try typing "rvm info" at the prompt. If you have RVM installed, it will print out a bunch of useful info about your ruby version. If you don't, it will say command not found. If you do have it, then you can select a different ruby version using "rvm use 1.9.2".
If you don't have RVM installed, then there are probably two versions manually installed on your host, and you'll need to figure out why rails is using 1.9.1.
In any case, I highly recommend using RVM. https://rvm.io.
Related
When running
rvm use ruby-2.0.0-p247
compass create . --bare --sass-dir "css" --css-dir "css" --javascripts-dir "js" --images-dir "img"
in a directory containing only html and css files I am getting the following error:
/Users/aljoscha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/definition.rb:361:in `validate_ruby!': Your Ruby version is 2.0.0, but your Gemfile specified 1.9.2 (Bundler::RubyVersionMismatch)
from /Users/aljoscha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler.rb:116:in `setup'
from /Users/aljoscha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /Users/aljoscha/.rvm/gems/ruby-2.0.0-p247/gems/compass-0.13.alpha.12/bin/compass:26:in `<top (required)>'
from /Users/aljoscha/.rvm/gems/ruby-2.0.0-p247/bin/compass:23:in `load'
from /Users/aljoscha/.rvm/gems/ruby-2.0.0-p247/bin/compass:23:in `<main>'
from /Users/aljoscha/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
from /Users/aljoscha/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'
This does not make sense to me, because there is not even a Gemfile present.
My questions:
What Gemfile could this message be refering to?
How can I make this run? I feel that creating a Gemfile because of that should not be necessary.
It's weird, but the reason seems to be that there was a Gemfile in my home dir.
Removing it made this error go away.
I am using the gem version 2.0.7 and rails version 3.0.7.
While i am running the rake db:migrate command it's throw the following error.
$ rake db:migrate --trace
rake aborted!
ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (ava
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/rdoctask.rb:2:in `<top
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks/documentation
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks/documentation
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks.rb:15:in `loa
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks.rb:15:in `blo
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks.rb:6:in `each
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/tasks.rb:6:in `<top
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:214:
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:214:
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:139:
c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:77:i
C:/Users/m/Documents/Aptana Studio 3 Workspace/rail1/Rakefile:6:in `<top (requir
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `l
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `l
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:637:in `
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:94:in `b
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:165:in `
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:93:in `l
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:77:in `b
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:165:in `
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:75:in `r
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.1.0/bin/rake:33:in `<top (required)>
c:/Ruby193/bin/rake:23:in `load'
c:/Ruby193/bin/rake:23:in `<main>'
How to solve it.
Please hlep me. Thanks in advance
The key part of the error message is this:
ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (ava
If you search for the error message on StackOverflow or Google you will find at least three different questions on the same topic, among others this:
ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (available in RDoc 2.4.2+) instead
The highest voted answer at the time of writing suggests editing your Rakefile from:
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
to:
require 'rake'
require 'rake/testtask'
require 'rdoc/task'
require 'tasks/rails'
If I were you, I would try to upgrade Rails to 3.2 and see if the problem persists. If that is not an option the older questions will hopefully be of help.
it can be solved it by installing an older version of rake, and uninstalling current 10.1.0 version:
gem install rake --version 0.8.7
gem uninstall rake --version 10.1.0
I am working on rails, suddenly rails server stops working. It's working fine and I have used following command [platform windows 7]
gem install -v=2.3.5 rails
And when I use rails s, it's giving the following error:
c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails_generator/options.rb:32:in `default_options': undefined method `write_inheritable_attribute' for Rails::Generator::Base:Class (NoMethodError)
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails_generator/base.rb:90:in `<class:Base>'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails_generator/base.rb:85:in `<module:Generator>'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails_generator/base.rb:48:in `<module:Rails>'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails_generator/base.rb:6:in `<top (required)>'
from c:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from c:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails_generator.rb:34:in `<top (required)>'
from c:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from c:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/bin/rails:14:in `<top (required)>'
from c:/Ruby193/bin/rails:23:in `load'
from c:/Ruby193/bin/rails:23:in `<main>'
$ rails -v
Rails 2.3.5
$ ruby -v
ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
I had the same problem, but it was the result of having the gem rmagick.
I ran the following:
gem uninstall rmagick
gem cleanup
And then re-ran bundle in my stack and it worked for me again.
I have solved this issue. Use following command and problem gone
gem install rails
This will install updated rails and all thing working find again.
Running bundle exec rails s worked for me.
My project was using Rails 3.x but when I ran rails -v I got 2.3.17 which is the version used by a project I worked on just before. Somehow installing this version must have be set as "default".
Could someone explain this ?
if you are using latest version of rails 3 or rails 4 then use class_attributes instead of write_inheritable_attribute, i.e.
class_attribute :variable_name
self.variable_name = value
instead of
write_inheritable_attribute(:variable_name, value)
I had this issue, and it happens that I was in using the wrong ruby and gemset in rvm.
(#jeremy-f and #alex-villa are on the right track to identifying the problem itself.)
The problem here is that the rails ... command in Rails version 2 is a generator, equivalent to rails new ... in Rails 3+. So rails s is a Rails 2 command to generate a new Rails 2 app called "s" (whereas most of us when we write rails s intend the Rails 3 usage, i.e. start a server!)
If you install a gem, it will usually install its binary in the path, so you should be able to cause this error by doing gem install rails -v 2.3.15 then rails s as the OP says.
Three ways to fix it:
gem install rails to install a newer version of Rails (you may have to specify a version >= 3.0)
Run the app with bundle exec rails s (only if you have Rails 3 in your Gemfile)
The usual way to run a Rails 2 project is simply script/server
I know these questions has been answered before but i cant start the rails server that i have set up. Someone posted the exact same error here Unable to start rails server but i cant get it to work with the answer. I'm really new at all this so help would be greatly appreciated.
/Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/mysql/lib/libmysqlclient.16.dylib (LoadError)
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle
Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle
from /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2.rb:8
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler.rb:120:in `require'
from /Users/valentin/Sites/simple_cms/config/application.rb:7
from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:28:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:28
from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:27:in `tap'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:27
from script/rails:6:in `require'
from script/rails:6
Im running:
mySQL: 5.5.11
rails: 3.0.7
ruby:1.8.7
gems: 1.7.2
mySQL2: 0.2.7
Can anyone please help? Thanks!
Neither of the other links were the same problem as yours, both of those problems were with older mysql2 gems that didn't have the full path to libmysqlclient.16.dylib in the bundle, notice that your error has the full path, Library not loaded: /usr/local/mysql/lib/libmysqlclient.16.dylib (the other questions did not have that).
Your problem is that that lib probably doesn't exist because that's not where MySQL will be installed in most OSX systems.
Assuming that you've installed MySQL you should have a command called mysql_config - you want to install your gem by pointing the installer at this file. The installed can then use the output from mysql_config to find the right place for all the MySQL libs it needs.
Bored and just want the answer?
sudo gem install mysql2 -- --with-mysql-config=`which mysql_config`
I am trying Rails 3 and I am using RVM to manage the ruby versions. Using RVM I had installed ruby versions 1.8.7, 1.9.1 and 1.9.2.
When I do "rails console" I am getting the following error and console isn't starting:
/home/syed/.rvm/rubies/ruby-1.9.2-preview3/lib/ruby/1.9.1/irb/completion.rb:9:in `require': no such file to load -- readline (LoadError)
from /home/syed/.rvm/rubies/ruby-1.9.2-preview3/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>'
from /home/syed/.rvm/gems/ruby-1.9.1-p378/gems/railties-3.0.0.beta4/lib/rails/commands/console.rb:3:in `require'
from /home/syed/.rvm/gems/ruby-1.9.1-p378/gems/railties-3.0.0.beta4/lib/rails/commands/console.rb:3:in `<top (required)>'
from /home/syed/.rvm/gems/ruby-1.9.1-p378/gems/railties-3.0.0.beta4/lib/rails/commands.rb:20:in `require'
from /home/syed/.rvm/gems/ruby-1.9.1-p378/gems/railties-3.0.0.beta4/lib/rails/commands.rb:20:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Since I don't require 1.9.1 any more to work with Rails 3, I un-installed it using the following command:
rvm uninstall ruby-1.9.1
Still rails console crashes. Am I doing something wrong?
I am using Ubuntu 10.04 and RVM to manage different ruby installations.
I had to do:
rvm package install readline
rvm remove 1.9.2
rvm install 1.9.2 -C --with-readline-dir=/home/syed/.rvm/usr/
following the instructions here:
http://rvm.beginrescueend.com/packages/readline/ and with help from
Sutto at #rvm irc.freenode.net