An error occurred while installing json (1.8.6), and Bundler cannot continue.
Make sure that gem install json -v '1.8.6' succeeds before bundling.
In Gemfile:
rails was resolved to 4.2.6, which depends on
actionmailer was resolved to 4.2.6, which depends on
actionpack was resolved to 4.2.6, which depends on
actionview was resolved to 4.2.6, which depends on
rails-dom-testing was resolved to 1.0.9, which depends on
rails-deprecated_sanitizer was resolved to 1.0.3, which depends on
activesupport was resolved to 4.2.6, which depends on
json
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /tmp/bundler20180201-46774-s2jlm4json-1.8.6/gems/json-1.8.6/ext/json/ext/generator
/usr/bin/ruby2.3 -r ./siteconf20180201-46774-16pojxx.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
what does this mean and how to correct it.I have already tried update and upgrade method is there any other ways to remove certain dependencies.
Try to update source list if necessary otherwise remove most of the files installed recently and then do a fresh install from the beginning.
Installed each held packages separately if needed other wise
sudo apt-get uprade
will also work.
Try this:
bundle update
In case of bundler error
gem install bundler #After that run below command too.
bundle install
Related
I'm a newbi to ruby
I have trouble executing the command :
bundle install
I'm using FEDORA28 and have installed ruby with rvm but apparently something is missing or a permission is wrong but I don't get it.
I have this answer :
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 12.0.0
Using concurrent-ruby 1.0.5
Using i18n 0.8.6
Using minitest 5.10.3
Using thread_safe 0.3.6
Using tzinfo 1.2.3
Using activesupport 5.1.3
Using builder 3.2.3
Using erubi 1.6.1
Using mini_portile2 2.2.0
Fetching nokogiri 1.8.0
Installing nokogiri 1.8.0 with native extensions
Errno::EACCES: Permission denied # rb_sysopen -
/home/BFournier/Documents/Boris/rothenberg/benchmark-headless-chrome-
vs-phantomjs/vendor/bundle/ruby/2.5.0/extensions/x86_64-
linux/2.5.0/nokogiri-1.8.0/gem_make.out
An error occurred while installing nokogiri (1.8.0), and Bundler
cannot continue.
Make sure that `gem install nokogiri -v '1.8.0' --source
'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
rails was resolved to 5.1.3, which depends on
actioncable was resolved to 5.1.3, which depends on
actionpack was resolved to 5.1.3, which depends on
actionview was resolved to 5.1.3, which depends on
rails-dom-testing was resolved to 2.0.3, which depends on
nokogiri
and when I try to execute this :
gem install nokogiri -v '1.8.0' --source 'https://rubygems.org/'
I have this :
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
current directory: /home/BFournier/.gem/ruby/gems/nokogiri-
1.8.0/ext/nokogiri
/usr/bin/ruby -r ./siteconf20181129-21800-1ke3w2r.rb extconf.rb
checking if the C compiler accepts ... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary
libraries and/or headers. Check the mkmf.log file for more details.
You may need configuration options.
I found some similar questions but everything i'e tried didn't work at the moment.
thanks in advance for any clues.
Silly me that was so simple I hate myself. It was just that I've probably installed something with sudo and the permission was only for ROOT user so I've just changed the right of the file and that's it.
Thanks again for your help #drosam
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 on Ubuntu 16.04 yields the following error when trying to install JSON.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /tmp/bundler20170601-12986-10dsu07json-1.8.6/gems/json-1.8.6/ext/json/ext/generator
/usr/bin/ruby2.3 -r ./siteconf20170601-12986-op73sp.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /tmp/bundler20170601-12986-10dsu07json-1.8.6/gems/json-1.8.6 for inspection.
Results logged to /tmp/bundler20170601-12986-10dsu07json-1.8.6/extensions/x86_64-linux/2.3.0/json-1.8.6/gem_make.out
An error occurred while installing json (1.8.6), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.6'` succeeds before bundling.
In Gemfile:
react-rails was resolved to 1.7.2, which depends on
rails was resolved to 4.2.7.1, which depends on
actionmailer was resolved to 4.2.7.1, which depends on
actionpack was resolved to 4.2.7.1, which depends on
actionview was resolved to 4.2.7.1, which depends on
rails-dom-testing was resolved to 1.0.8, which depends on
rails-deprecated_sanitizer was resolved to 1.0.3, which depends on
activesupport was resolved to 4.2.7.1, which depends on
json
It looks as if the gem extensions couldn't be compiled because of lacking header files. What can I do?
It seems that there is similar problem on RedHat 7.
In case of Ubuntu, the solution seems to be installing ruby-dev package.
sudo apt-get install ruby-dev
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!
I get two different results when using the two commands bundle and bundle update
If I use bundle update, I get the following error:
Resolving dependencies...
Bundler could not find compatible versions for gem "railties":
In Gemfile:
requirejs-rails (>= 0) ruby depends on
railties (~> 3.1.1) ruby
rails (= 4.0.0.rc2) ruby depends on
railties (4.0.0.rc2)
Bundler could not find compatible versions for gem "rails":
In Gemfile:
requirejs-rails (>= 0) ruby depends on
rails (~> 3.1.1) ruby
rails (4.0.0.rc2)
But if I use just bundle, I get the following :
Resolving dependencies...
Bundler could not find compatible versions for gem "activesupport":
In snapshot (Gemfile.lock):
activesupport (3.2.2)
In Gemfile:
rails (= 4.0.0.rc2) ruby depends on
activesupport (= 4.0.0.rc2) ruby
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
The errors point to two different dependencie issues, but both commands are fetching gem metadata from https://rubygems.org/... and Resolving dependencies..., so how are they different?
I have always used just bundle, but tried bundle update and noticed the difference.
In a nutshell: bundle install handles changes to the Gemfile and
bundle update upgrades gems that are already managed by Bundler.
http://viget.com/extend/bundler-best-practices
Needless to say that bundle and bundle install are the same command, install is the default option for bundle.
bundle is the same as bundle install, which does the following:
Check if a Gemfile.lock exists. If it does, install all gems with the exact versions specified there.
If the lock doesn't exist, install gems as specified in the Gemfile, using the latest available / allowable versions according to the Gemfile. Then create the Gemfile.lock to record what versions have been installed.
bundle update on the other hand, deletes / ignores your Gemfile.lock and goes straight to step two.
The error you're seeing is probably because some gem wants active_support to be in the 3.x.x version range, while you seem to be trying to upgrade to Rails 4.