When I run command to create rails app, i get error Unable to activate rails-dom-testing-1.0.7, because nokogiri-1.5.11 conflicts with nokogiri (~> 1.6.0) (Gem::ConflictError)
How can i uninstall old version of nokogiri? or use new version by default?
Try gem uninstall nokogiri -v '1.5.11'
Related
I'm running a Rails app and getting this error whilst running in Docker.
There are no results on Google for what the cause might be.
The gem doesn't appear in my Gemfile so it must be a dependency of Rails or another gem.
The previous error I was getting was:-
Could not find 'nokogiri' (>= 1.5.9) among 144 total gem(s) (Gem::MissingSpecError)
To resolve this, I added gem install nokogiri to my Dockerfile, which now gives me the title error. Any ideas?
When you add gem install nokogiri in your Dockerfile, it will install linux compatible nokogiri (1.13.3-x86_64-linux) and will add that to your Gemfile.lock.
When you run rails on your mac, it will need mac compatible nokogiri (1.13.3-x86_64-darwin)
Here is how I fixed this:
I first ran bundle install from my Mac, that added 1.13.3-x86_64-darwin in my Gemfile.lock.
Before running docker-compose up, I added linux platform to my Gemfile.lock by running:
bundle lock --add-platform x86_64-linux
This is what my Gemfile.lock has now:
...
nokogiri (1.13.3-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.13.3-x86_64-linux)
racc (~> 1.4)
...
PLATFORMS
x86_64-darwin-21
x86_64-linux
When trying to run 'bundle install', I have this message :
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 5.0.2) was resolved to 5.0.2, which depends on
bundler (>= 1.3.0, < 2.0)
Current Bundler version:
bundler (2.1.2)
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.3.0, < 2.0)', which is required by gem 'rails (= 5.0.2)', in any of the sources.
Bundler could not find compatible versions for gem "pg":
In Gemfile:
pg (= 0.18.3)
jsonb_accessor (~> 1.0.0) was resolved to 1.0.0, which depends on
pg (>= 0.18.1)
Then, I think I need to change my bundler version why is 2.1.2, I would like to change to 1.17.3.
gem list command says :
bundler (default 1.17.3)
but bundle -v command says :
Bundler version 2.1.2
I am using ruby 2.5.1 with RVM.
Do you have any idea how to do so ?
I read that I can use bundle config set but it does nothing.
Bundler installs a binary that gets invoked before your Gemfile is read, so you'll need to remove the version you are using and install the version you want.
You can do this with RVM with the following:
rvm #global do gem uninstall bundler -a -x -I || true
gem install bundler -v '= 1.17.3'
If you hop between projects, you may have to do this a lot, or you can do this:
gem install bundler -v '= 1.17.3'
And instead of using bundle install, use:
bundle _1.17.3_ install
to specify the version of the bundler gem gets used.
I would recommend you look into upgrading Rails, not only to get on a supported version (that has security updates), but it will also allow you to upgrade bundler again.
You need to delete manually the directory on your problematic ruby version: for example if there is a bundler problem with the 2.5.1 ruby version, go to this path:
/Users/YOUR_USER/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/
and delete the bundler directory.
If bundler is in the default specification you also need to remove the bundler associated file on this path:
/Users/YOUR_USER/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/specifications/default
Then you can re-install a specific version of bundler using #Unixmonkey answer
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'
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
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.