install ruby on rails Mac os - ruby-on-rails

hello guys i have checked all people sharing about installing ruby on rails but its the same problem
like this:
Fetching selenium-webdriver 3.4.3
Using listen 3.1.5
Using rails-dom-testing 2.0.3
Using globalid 0.4.0
Using activemodel 5.1.2
Using jbuilder 2.7.0
Using spring 2.0.2
Using rails-html-sanitizer 1.0.3
Using capybara 2.14.4
Bundler::GemspecError: Could not read gem at
/usr/local/lib/ruby/gems/2.4.0/cache/selenium-webdriver-
3.4.3.gem. It may be
corrupted.
An error occurred while installing selenium-webdriver (3.4.3), and
Bundler cannot continue.
Make sure that gem install selenium-webdriver -v '3.4.3' succeeds before
bundling.
In Gemfile:
selenium-webdriver
run bundle exec spring binstub --all
Could not find gem 'sass-rails (~> 5.0)' in any of the gem sources listed in your Gemfile.
Run bundle install to install missing gems.

I have experience with this driver, and downgraded to lower version here is the sample that work with my system, you can delete minitest incase you don't need it. I'm using rails 5.0.2
group :development, :test do
gem 'selenium-webdriver', '2.53.4'
gem 'minitest-rails-capybara'
gem 'minitest-reporters'
end

Bundler is trying to fetch the selenium-webdriverfrom its cache. Also, bundler suggests that the package is probably corrupt. You can try removing it from cache so bundler can install the gem again.
rm -f /usr/local/lib/ruby/gems/2.4.0/cache/selenium-webdriver-3.4.3.gem
bundle install

Related

Rails bundler won't bundle install

I have been fighting this thing for days. I'm on rbenv and I have multiple rubies installed trying to get one stupid decade old app running. When I do "bundle install" I get an error that looks like it's trying to install the current version of rake. Instead of using the version installed with Rails 3....see below
fonso#mybox:~/my-dev$ rails -v
Rails 3.0.0
fonso#mybox:~/my-dev$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
fonso#mybox:~/my-dev$ gem list
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.0)
actionpack (3.0.0)
activemodel (3.0.0)
activerecord (3.0.0)
activeresource (3.0.0)
activesupport (3.0.0)
arel (1.0.1)
bigdecimal (1.1.0)
builder (2.1.2)
bundler (1.0.22) <-----------Note bundler is installed
erubis (2.6.6)
i18n (0.4.2)
io-console (0.3)
json (1.5.5)
mail (2.2.20)
mime-types (1.25.1)
minitest (2.5.1)
polyglot (0.3.5)
rack (1.2.8)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.0)
railties (3.0.0)
rake (0.9.2.2) <--------Note rake is installed
rdoc (3.9.5)
thor (0.14.6)
treetop (1.4.15)
tzinfo (0.3.60)
Here is my Gemfile...
source 'http://rubygems.org'
gem 'rails', '3.0.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'pg'
gem 'will_paginate', '~> 2.3.17'
gem 'soap4r-middleware', '~> 0.8.6'
gem 'soap4r', '~> 1.5.6'
gem 'prawn-labels', '~> 0.11.3.0'
gem 'nokogiri-plist', '~> 0.3.0'
gem 'rails_sql_views', '~> 0.8.0'
# gem 'prototype_legacy_helper', '0.0.0', :git => 'https://github.com/rails/prototype_legacy_helper.git'
so Ruby and rails are installed...BUT when I do "bundle install" on my Rails 3 app I get...
fonso#mybox:~/my-dev$ bundle install
Fetching source index for http://rubygems.org/
Installing rake (13.0.3)
Gem::InstallError: rake requires Ruby version >= 2.2.
An error occured while installing rake (13.0.3), and Bundler cannot continue.
Make sure that `gem install rake -v '13.0.3'` succeeds before bundling.
fonso#mybox:~/my-dev$ bundler --version
rbenv: bundler: command not found
Why does it say bundler not found yet I can run Bundle install?
Why can I not get this rails 3 app working?
Any info will help my sanity. Thank you.
UPDATE:
After following Paul D solution I ran bundle install again...but got this error...
fonso#mybox:~/my-dev$ bundle install
Fetching gem metadata from http://rubygems.org/.............
Fetching gem metadata from http://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.0) was resolved to 3.0.0, which depends on
bundler (~> 1.0.0)
Current Bundler version:
bundler (1.17.3)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
Could not find gem 'bundler (~> 1.0.0)', which is required by gem 'rails (= 3.0.0)', in any of the sources.
#thefonso, I manage multiple decade old apps running stable on Ruby 1.9.3-p551 daily. Here are a few things to ensure:
Make sure you're running latest release of Ruby 1.9 which is 1.9.3-p551. It needs to be installed with SSL/TLS patches as per below:
# Make sure you have latest OpenSSL
sudo apt-get purge -y libssl-dev
sudo apt-get install -y libssl1.0-dev
# Now install Ruby 1.9.3-p551
rbenv install --force --patch 1.9.3-p551 < <(curl -sSL https://git.io/JOtSv)
rbenv global 1.9.3-p551 # (optional)
rbenv rehash
# Now install Bundler 1.17.3
gem install bundler -v 1.17.3 --no-rdoc --no-ri
# Add require 'openssl' to .../versions/1.9.3-p551/bin/bundle file right under require 'rubygems'
# This command below will do it automatically for you as long as you provide it the correct file path
sed "/^require .*/a require 'openssl'" -i "PATH_TO_RBENV_DIR_HERE/versions/1.9.3-p551/bin/bundle"
# That's it! Run commands below to ensure you have patched Ruby 1.9.3-p551
rbenv rehash
curl -Lks 'https://git.io/rg-ssl' | ruby
Now that's out of the way, you can try installing rake 10.5.0
gem install rake -v 10.5.0 --no-ri --no-rdoc
A Gemfile.lock would avoid this problem. If you had one from the last time you ran this code, it would still have the appropriate versions for Rails 3 and Ruby 1.9. Bundler would follow the Gemfile.lock. Unfortunately back then it was not the practice to commit Gemfile.lock.
Since you don't have a Gemfile.lock you're in dependency hell. Bundler is trying to resolve the dependencies using each gem's own gemspec. It doesn't matter which gems you have installed. Where versions are specified it will use that. Where they are not, it will try to use the latest version. Most gems aren't thinking about Ruby 1.9 any more, or old versions of gems didn't have good dependency specifications, so there's going to be problems.
For example, Rails 3.0.0's rails.gemspec depends on railties 3.0.0. railties 3.0.0's railties.gemspec depends on rake >= 0.8.4. There's no upper bound, so Bundler grabs the latest rake and it doesn't work with Ruby 1.9.
To solve this you will need to add more versioned dependencies to your Gemfile. For example, rake 11 should work with Ruby 1.9. Try adding this to your Gemfile.
gem 'rake', '~> 11'
Or you can be super conservative and specify the exact versions you have installed.
gem 'rake', '0.9.2.2'
Run bundle. This should get you past rake and onto the next dependency problem. Add a version restriction for that and bundle. Continue until there's no more dependency issues. Check in the Gemfile.lock.

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'

Bundler could not find compatible versions for gem "bundler": In Gemfile: rails (= 3.0.0) was resolved to 3.0.0, which depends on bundler (~> 1.0.0)

I just bought a new MBP and I'm trying to execute a ruby app. After I followed this tutorial Install Ruby on Rails 5.0 ยท macOS Sierra,
I'm still having this issue:
MBP:test_app $ gem install rails
Successfully installed rails-5.0.1
Parsing documentation for rails-5.0.1
Done installing documentation for rails after 0 seconds
1 gem installed
MBP:test_app $ rails new .
Could not find gem 'rails (= 3.0.0)' in any of the gem sources listed in your Gemfile or available on this machine.
Try running `bundle install`.
Then, I tried:
$ bundle install
And I got the following error:
Fetching gem metadata from http://rubygems.org/..........
Fetching version metadata from http://rubygems.org/..
Fetching dependency metadata from http://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.0) was resolved to 3.0.0, which depends on
bundler (~> 1.0.0)
Current Bundler version:
bundler (1.13.7)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
Could not find gem 'bundler (~> 1.0.0)', which is required by gem 'rails (=
3.0.0)', in any of the sources.
I guess I've already tried everything; installed bundler 1.0.0, reinstalled, deleted gems, removed ruby, rails, rvm, and installed everything again.
Please, any advice?
Solved!!
The problem was solved removing or commenting config.action_view.debug_rjs = true in development.rb file.
Thanks to everyone!

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.

For Rails, if there is a project that uses Rails 3.0.0, it looks for bundler 1.0.0 and it is there but rails server won't run?

I have a Rails 3.0.0 project that was using Ruby 1.9.2. Now that I tried to run it on a new computer with the current rvm, it will say:
$ rails s
/Users/michael/.rvm/gems/ruby-1.9.2-p318#global/gems/bundler-1.1.3/lib/bundler/resolver.rb:129:in `block in resolve': Bundler could not find compatible versions for gem "bundler": (Bundler::VersionConflict)
In Gemfile:
rails (= 3.0.0) ruby depends on
bundler (~> 1.0.0) ruby
Current Bundler version:
bundler (1.1.3)
but I already used
gem install rails -v 3.0.0
gem install bundler -v 1.0.0
gem install bundler -v 1.0.2
so that when I gem list, I will see
bundler (1.1.3, 1.0.22, 1.0.0)
rails (3.0.0)
so how come it is still complaining that Rails 3.0.0 requires bundler 1.0.0 and it is not there? How to make the project run again?
Update: my Gemfile is mostly comments except:
source 'http://rubygems.org'
gem 'rails', '3.0.0'
gem 'sqlite3-ruby', :require => 'sqlite3'
Update 2: if I run bundle check:
$ bundle check
Your Gemfile's dependencies could not be satisfied
Install missing gems with `bundle install`
$ bundle install
Fetching gem metadata from http://rubygems.org/.........
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.0) ruby depends on
bundler (~> 1.0.0) ruby
Current Bundler version:
bundler (1.1.3)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
The problem is that you have three version of bundler (1.1.3, 1.0.22, 1.0.0).And your app require only 1.0.0.And when you run server it use 1.1.3.
So first uninstall two bundler by this command
gem uninstall bundler -v=1.1.3
gem uninstall bundler -v=1.0.22
Then run server it will sure work....
You may need to run rails and rake inside the bundler context:
bundle exec rails s
Ditt with your rake commands, e.g.,
bundle exec rake -T
Here's a SO thread with links to more in depth articles. Also, lots of chatter about how to get around it if you get annoyed. Personally, I alias my most common commands anyway, so I don't even notice.
Just add Bundler into your gemfile to lock the version of bundler to use for that project.
gem 'bundler', '1.1.0'
If you do this you do not need to uninstall the other versions of Bundler, which you may be using on other projects with different dependencies.
You also shouldn't need to use bundle exec for any rails commands as Rails is bundler aware and will always run in the context of the current bundle. Non Rails commands require `bundle exec'.

Resources