Error when creating new rails project and running rails -v - ruby-on-rails

I'm new to rails and I seem to get this error whenever I try to create a new project. Does anybody have any insight into what I need to do with this error message? I get the same error when running 'rails -v'
/Users/buckleyjosh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:298:in `to_specs': Could not find 'json' (~> 1.4) among 137 total gem(s) (Gem::LoadError)
from /Users/buckleyjosh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1271:in `block in activate_dependencies'
from /Users/buckleyjosh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1260:in `each'
from /Users/buckleyjosh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1260:in `activate_dependencies'
from /Users/buckleyjosh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1242:in `activate'
from /Users/buckleyjosh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1274:in `block in activate_dependencies'
from /Users/buckleyjosh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1260:in `each'
from /Users/buckleyjosh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1260:in `activate_dependencies'
from /Users/buckleyjosh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1242:in `activate'
from /Users/buckleyjosh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_gem.rb:48:in `gem'
from /Users/buckleyjosh/.rvm/gems/ruby-1.9.3-p194/bin/rails:18:in `<main>'
from /Users/buckleyjosh/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/buckleyjosh/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'

The error is exactly what it's complaining about:
Could not find 'json' (~> 1.4) among 137 total gem(s)
Install that gem before you fire any rails commands : gem install json
If you're using rvm, make sure you've the right version of ruby loaded before installing the gem.
Read this more information on what this gem does.

Related

Rails not working anymore... I think I messed up

I think I screwed up and now I'm stuck with this error message :(
How do I get out of here?
pedal#RN-145-97-138-125:~$ rails -v
/Users/pedal/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:315:in
`to_specs': Could not find 'actionpack' (= 4.2.1) among 62 total
gem(s) (Gem::LoadError) Checked in
'GEM_PATH=/Users/pedal/.rvm/gems/ruby-2.2.1:/Users/pedal/.rvm/gems/ruby-2.2.1#global',
execute `gem env` for more information from
/Users/pedal/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb:1311:in
`block in activate_dependencies' from
/Users/pedal/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb:1300:in
`each' from
/Users/pedal/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb:1300:in
`activate_dependencies' from
/Users/pedal/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb:1282:in
`activate' from
/Users/pedal/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:67:in
`block in gem' from
/Users/pedal/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:66:in
`synchronize' from
/Users/pedal/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:66:in
`gem' from /Users/pedal/.rvm/rubies/ruby-2.2.1/bin/rails:22:in
`<main>' from
/Users/pedal/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in
`eval' from
/Users/pedal/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in
`<main>'ยงยงยงยง
Try
gem pristine --all
Then
bundle install
In the terminal of project folder
It looks like you're missing the actionpack gem. Try (re-)installing it with gem install actionpack.

Rails rack conflict

I got a rack conflict error after installing ruby and rails on OSX.
sudo rails new test -T
/Library/Ruby/Site/1.8/rubygems/specification.rb:1990:in `raise_if_conflicts': Unable to activate actionpack-3.2.13, because rack-1.5.2 conflicts with rack (~> 1.4.5) (Gem::LoadError)
from /Library/Ruby/Site/1.8/rubygems/specification.rb:1163:in `activate'
from /Library/Ruby/Site/1.8/rubygems/specification.rb:1199:in `activate_dependencies'
from /Library/Ruby/Site/1.8/rubygems/specification.rb:1185:in `each'
from /Library/Ruby/Site/1.8/rubygems/specification.rb:1185:in `activate_dependencies'
from /Library/Ruby/Site/1.8/rubygems/specification.rb:1167:in `activate'
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_gem.rb:48:in `gem'
from /usr/bin/rails:18
Please try this:
gem uninstall rack
Select gem to uninstall:
1. rack-1.4.5
2. rack-1.5.2
3. All versions
>2
Successfully uninstalled rack-1.5.2

Getting omniauth-facebook (and omniauth-oauth2) to work on Rails 2.3.4

I'm trying to get the omniauth-facebook gem working in my Rails 2.3.4 application, but it depends on omniauth-oauth2, which in turn depends on rack ~> 1.2. When I try requiring it in my application I get this error message:
[Dev]> require 'omniauth-facebook'
Gem::LoadError: can't activate rack (~> 1.2, runtime) for ["oauth2-0.8.0", "omniauth-oauth2-1.1.0", "omniauth-facebook-1.4.1"], already activated rack-1.0.1 for []
from /Library/Ruby/Site/1.8/rubygems.rb:233:in `activate'
from /Library/Ruby/Site/1.8/rubygems.rb:249:in `activate'
from /Library/Ruby/Site/1.8/rubygems.rb:248:in `each'
from /Library/Ruby/Site/1.8/rubygems.rb:248:in `activate'
from /Library/Ruby/Site/1.8/rubygems.rb:249:in `activate'
from /Library/Ruby/Site/1.8/rubygems.rb:248:in `each'
from /Library/Ruby/Site/1.8/rubygems.rb:248:in `activate'
from /Library/Ruby/Site/1.8/rubygems.rb:249:in `activate'
from /Library/Ruby/Site/1.8/rubygems.rb:248:in `each'
from /Library/Ruby/Site/1.8/rubygems.rb:248:in `activate'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:35:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
from (irb):1
This error is caused by the fact that actionpack 2.3.4 requires rack ~> 1.0.0, and so by the time omniauth-oauth2 gets around to requiring ~> 1.2, 1.0.1 has already been loaded and it blows up
How can I get around this problem without upgrading my Rails version? (Would using an older version of omniauth-facebook work?)

Rails Dysfunctional, requiring rack 1.3.5, have 1.4.0 but can't install 1.3.5

$ rails
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in `report_activate_error': RubyGem version error: rack(1.4.0 not ~> 1.3.5) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:246:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:246:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem'
from /usr/bin/rails:18
Then I try this:
$ sudo gem install rack 1.3.5
Password:
Successfully installed rack-1.4.0
ERROR: could not find gem 1.3.5 locally or in a repository
1 gem installed
Installing ri documentation for rack-1.4.0...
Cannot read termcap database;
using dumb terminal settings.
Installing RDoc documentation for rack-1.4.0...
then again but different:
rails
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:230:in `activate': can't activate rack (~> 1.3.5, runtime) for ["actionpack-3.1.3", "rails-3.1.3"], already activated rack-1.4.0 for ["rack-cache-1.1", "actionpack-3.1.3", "rails-3.1.3"] (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:246:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:246:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem'
from /usr/bin/rails:18
You have to install rack 1.3.5 and remove rack 1.4.0
sudo gem install rack -v 1.3.5
sudo gem uninstall rack -v 1.4.0
The command to install a specific version is
sudo gem install rack --version=1.3.5
What you've written is trying to find a gem called 1.3.5
I'm believe its because of rack gem versions.
Give the command gem list rack
Its displays all the rack gems versions, after that I uninstalled all rack versions and run the bundle command hope you specified which version of rack you want in Gemfile.
I believe its because if you specify a rack version in Gemfile and if gems contrails a version greater than that, it my causes error.
So try to uninstall all the rack gems and run bundle command.
Hope it may help.

RubyGem version error: activesupport(1.4.4 not = 3.0.0.beta) (Gem::LoadError)

I want to use the last version of rails, in my Gemfile: gem 'rails', '3.0.0.beta3'
When trying to start my server I get this error, do you know how I can fix this issue?
$rails s
/Library/Ruby/Site/1.8/rubygems.rb:777:in `report_activate_error': RubyGem version error: activesupport(1.4.4 not = 3.0.0.beta) (Gem::LoadError)
from /Library/Ruby/Site/1.8/rubygems.rb:211:in `activate'
from /Library/Ruby/Site/1.8/rubygems.rb:246:in `activate'
from /Library/Ruby/Site/1.8/rubygems.rb:245:in `each'
from /Library/Ruby/Site/1.8/rubygems.rb:245:in `activate'
from /Library/Ruby/Site/1.8/rubygems.rb:1056:in `gem'
from /usr/bin/rails:18
bundle install return Your bundle is complete!
gem list give me
activesupport (3.0.0.beta3, 2.3.5, 2.2.2, 1.4.4)
ok so you have activesupport 3.0.0.beta3 while it requires activesupport 3.0.0.beta. Try this:
gem install activesupport -v 3.0.0.beta --pre

Resources