Rails version error (inconsistency) - ruby-on-rails

When I try to run rails s or rails c I get the following error:
Your Ruby version is 2.3.1, but your Gemfile specified 2.1.2
so I try ruby -v and get:
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
and when I do which ruby I get:
/home/xxx/.rvm/rubies/ruby-2.1.2/bin/ruby
Even if I explicitly run rvm use 2.1.2 I still get the same error.
Can somebody please explain me what is wrong??

Solved - problem was old version of raindrops Gem.
Since I never use bundle update, I had an old version of it. The Gemfile.lock looked like this:
GEM
remote: https://rubygems.org/
specs:
:
:
raindrops (0.12.0)
:
:
unicorn (4.7.0)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
I deleted the line of the independent gem (0.12.0) and ran bundle install. I got this gem back with version 0.17.0.

Related

How do I get Rails 5.0.6 working on Windows with Ruby 2.4 and Nokogiri 1.8.1?

I upgraded Ruby from 2.3 to 2.4. When I run bundle, I get
C:\Users\Chloe\workspace>bundle
Fetching gem metadata from https://rubygems.org/.........
Gem::InstallError: nokogiri requires Ruby version < 2.4, >= 2.1.0.
An error occurred while installing nokogiri (1.7.0.1), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.7.0.1'` succeeds before bundling.
In Gemfile:
nested_form_fields was resolved to 0.8.2, which depends on
rails was resolved to 5.0.2, which depends on
actioncable was resolved to 5.0.2, which depends on
actionpack was resolved to 5.0.2, which depends on
actionview was resolved to 5.0.2, which depends on
rails-dom-testing was resolved to 2.0.2, which depends on
nokogiri
However, I was able to install Rails manually with gem install rails --version 5.0.6. It installed Nokogiri 1.8.1. (I also installed, then removed Rails 5.0.2.)
C:\Users\Chloe\workspace>gem list nokogiri
*** LOCAL GEMS ***
nokogiri (1.8.1 x64-mingw32)
However, bundle and rails -v still won't work.
C:\Users\Chloe\workspace>rails -v
Could not find nokogiri-1.7.0.1-x64-mingw32 in any of the sources
Run `bundle install` to install missing gems.
Gemfile
gem 'rails', '~> 5.0.2'
ruby '~> 2.4.0'
...
I don't know how to prove this since the nokogiri team does not release a gemspec, but that version of nokogiri may not support ruby 2.4 on Windows.
Take a look at:
https://github.com/sparklemotion/nokogiri/blob/v1.7.1/.cross_rubies. IT does not include ruby 2.4.x.
If you absolutely need to upgrade to ruby 2.4 try locking nokogiri version on 1.8.1, which seems to support ruby 2.4 on windows as per https://github.com/sparklemotion/nokogiri/blob/v1.8.1/.cross_rubies
gem 'nokogiri', '1.8.1'

bundle show ['bcrypt-ruby'] Unfortunately, a fatal error has occurred. on Mac

i've problem on Mac ruby 1.9.3p448 (2013-06-27 revision 41675) with bcrypt-ruby - any version. If i install bcrypt - Rspec ask to install bcrypt-ruby too...(( why? i' m in the begin of Rails too - with M.Hartl....)) .After installing'bcrypt-ruby'- in order i try all versions- i take this result:
$bundle install
.....
Using sass-rails 4.0.3
Using activeadmin 1.0.0.pre from git://github.com/gregbell/active_admin.git (at master)
Using bcrypt 3.1.7
Using bcrypt-ruby 3.1.5
Using bootstrap-sass 2.3.2.0
Using mini_portile 0.6.0
Using nokogiri 1.6.2.1
.....
$bundle exec rspec spec/
You don't have bcrypt-ruby installed in your application. Please add it to your Gemfile and run bundle install
/Users/alla/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/bundler-1.6.2/lib/bundler/rubygems_integration.rb:262:in `block in replace_gem': can't activate bcrypt-ruby (~> 3.0.0), already activated bcrypt-ruby-3.1.5. Make sure all dependencies are added to Gemfile. (Gem::LoadError)
bundle show ['bcrypt-ruby']
Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
What the matter!?
I do all in this documentation^, but problem don't disappear...
Try with the older versions of 'bcrypt-ruby' and omit 'bcrypt' though it is recommended to use 'bcrypt' instead of 'bcrypt-ruby'. For instance, 'bcrypt-ruby', '~> 3.0.1'.
That looks like a bug in bundler triggered by how you're using it.
The correct command is:
bundle show bcrypt-ruby
No square brackets, no quotes.
If you want to see the all the versions of bcrypt-ruby installed on your machine then you can use following command
gem list bcrypt-ruby
It will show you all the versions of bcrypt-ruby installed on machine.

Rails messed up cant' find gems

I don't know what's going on with my installation of ruby / rails under OSX Mountain Lion.
I start with a black rails application, run bundle and listing the installed bundles with bundle show I get this:
[..]
* sqlite3 (1.3.7)
* thor (0.17.0)
* tilt (1.3.3)
* treetop (1.4.12)
[..]
As soon as I run rake db:migrate I get the following error:
Could not find thor-0.17.0 in any of the sources
Run `bundle install` to install missing gems.
But, as shown, thor-0.17 is installed. If I force it:
sudo gem install --version 0.17 thor
Successfully installed thor-0.17.0
1 gem installed
Installing ri documentation for thor-0.17.0...
Installing RDoc documentation for thor-0.17.0...
And run the migration again, I keep having dependency errors (in this case "Could not find formtastic-2.2.1 in any of the sources") for gems that bundle says are already installed. Any help? Thanks
EDIT
Gemfile: http://pastebin.com/WSz5dLrm
Gemfile.lock: http://pastebin.com/2kuFz1kK
So after using your Gemfile I got the following error :
Bundler could not find compatible versions for gem "railties": In
Gemfile:
rails (= 3.2.8) ruby depends on
railties (= 3.2.8) ruby
sass-rails (~> 3.2.3) ruby depends on
railties (3.2.11)
Bundler could not find compatible versions for gem "actionpack": In
snapshot (Gemfile.lock):
actionpack (3.2.11)
In Gemfile:
meta_search (>= 1.1.0.pre) ruby depends on
actionpack (~> 3.1.0.alpha) ruby
Running bundle update will rebuild your snapshot from scratch, using
only the gems in your Gemfile, which may resolve the conflict.
Using rails with the version 3.2.11 fixed the bundle.
Rails 3.2.11 fixes a huge security threat anyway, so update !

rails 2.3.14 + google adwords api = trouble

Project rails 2.3.14
gem 'google-adwords-api', '0.7.2'
bundle install
The error:
Bundler could not find compatible versions for gem
"rack": In Gemfile:
google-adwords-api (= 0.7.2) ruby depends on
rack (~> 1.4) ruby
rails (= 2.3.14) ruby depends on
rack (1.1.0)
Is it possible to fix this issue without using newer version of Rails?
try this..
bundle exec bundle install
You could try it without a specific version, to see if there are any compatable versions, like this gem 'google-adwords-api' instead of gem 'google-adwords-api', '0.7.2'.

Error trying to run rails server

I am trying to get a basic Rails application to run on my Mac OS X 10.6.5. I created a new app called demo (rails new demo), then went into the demo directory and tried to start the app with rails server.
Here is the error message I received:
"/Users/dpetrovi/.gem/ruby/1.8/gems/sqlite3-ruby-1.3.2/lib/sqlite3/sqlite3_native.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2010-12-23 patchlevel 330) [i686-darwin10]
Abort trap"
I checked bundle install in the demo folder:
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.6)
Using tzinfo (0.3.23)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.13)
Using actionmailer (3.0.3)
Using arel (2.0.6)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bundler (1.0.7)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Using sqlite3-ruby (1.3.2)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Ruby, RubyGems, and sqlite3 were installed using MacPorts. Then I used gem to try to install the sqlite3-ruby interface. (sudo gem install sqlite3-ruby). Here is where I first noticed something could be off:
Successfully installed sqlite3-ruby-1.3.2
1 gem installed
Installing ri documentation for sqlite3-ruby-1.3.2...
No definition for libversion
Enclosing class/module 'mSqlite3' for class Statement not known
Installing RDoc documentation for sqlite3-ruby-1.3.2...
No definition for libversion
Enclosing class/module 'mSqlite3' for class Statement not known
I had rails running well on my system a few months ago, so I figured maybe I had some duplicates and it was trying to use the wrong one. I ran: for cmd in ruby irb gem rake; do which $cmd; done and got:
/opt/local/bin/ruby
/opt/local/bin/irb
/opt/local/bin/gem
/opt/local/bin/rake
Checking where sqlite3 also gets me: "/opt/local/bin/sqlite3" so they all seem to be in the right place. Obviously /opt/local/bin is in my system path.
If I check gems server, it shows that I have installed sqlite3-ruby 1.3.2 gem. Not sure what the problem could be?
I am using ruby 1.8.7 (2010-12-23 patchlevel 330) [i686-darwin10]. Macports claims this is the latest (although ive seen 1.9.1)
One more thing-- in irb, I tried to check which version of sqlite3 my sqlite3-ruby is bound to, but I can only get this far:
:irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'sqlite3'
/Users/dpetrovi/.gem/ruby/1.8/gems/sqlite3-ruby-1.3.2/lib/sqlite3/sqlite3_native.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2010-12-23 patchlevel 330) [i686-darwin10]
Abort trap
Any suggestions? Im hoping I overlooked something obvious. Thanks
Have you upgraded to Snow Leopard recently? If so, you need to reinstall MacPorts and all the ports installed with it.
I recommend using RVM instead MacPorts installed ruby.
Definitely use RVM as mentioned above and then try this in your app's directory:
rm -rf .bundle && bundle install
i had the same problem. here is how i resolved it.
removed the gem sqlite3-ruby
did bundle install
reinstalled the gem
recreated the rails app
now webrick works fine.

Resources