I started a new rails project, cd'd inside it and then tried to bundle install
I got the following error
An error occurred while installing nokogiri (1.6.7), and Bundler cannot
continue.
Make sure that gem install nokogiri -v '1.6.7' succeeds before bundling.
I am pretty sure this is a level A problem I tried googling it but found nothing, hope i didnt overlook it
Thanks for any help
edit: if i try to manually install nokogiri it gives the following error
Adams-MacBook-Pro:fancy_cars adamkatz$ gem install nokiogiri
ERROR: Could not find a valid gem 'nokiogiri' (>= 0) in any repository
ERROR: Possible alternatives: nokogiri, nokogirl, niceogiri, onigiri
Adams-MacBook-Pro:fancy_cars adamkatz$ gem install nokogiri
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/adamkatz/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20151213-2420-12wvig2.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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/adamkatz/.rbenv/versions/2.2.3/bin/$(RUBY_BASE_NAME)
--help
--clean
/Users/adamkatz/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/adamkatz/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in `block in try_compile'
from /Users/adamkatz/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:522:in `with_werror'
from /Users/adamkatz/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in `try_compile'
from extconf.rb:80:in `nokogiri_try_compile'
from extconf.rb:87:in `block in add_cflags'
from /Users/adamkatz/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:619:in `with_cflags'
from extconf.rb:86:in `add_cflags'
from extconf.rb:336:in `'
extconf failed, exit code 1
Gem files will remain installed in /Users/adamkatz/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.7 for inspection.
Results logged to /Users/adamkatz/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.7/gem_make.out
You need to install the OS X development tools (the output says so, towards the end).
Here are some good instructions on installing xcode: Installing Ruby on Rails on Mac for Ruby on Rails development (about half way down)
If that works it looks like the simplest way to get you there.
If that doesn't work you might find help here:
http://tosbourn.com/nokogiri-wont-install-check-accepted-xcodes-eula/
SO: Installing Nokogiri on OS X 10.10 Yos
Related
I'm getting this error when I'm trying to bundle install an older project. I'm stuck and not sure how to fix this. I'm getting error on multiple projects. Is there a way to maintenance it? I've tried bundle update. Does anyone have any ideas? I upgraded to macOS Mojave 10.14.6. Thank you
Fetching nokogiri 1.10.4
Installing nokogiri 1.10.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/myname/.gem/ruby/2.5.1/gems/nokogiri-1.10.4/ext/nokogiri
/usr/local/opt/ruby/bin/ruby -r ./siteconf20190822-3395-a2lga2.rb extconf.rb
checking if the C compiler accepts -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2... *** 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.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/Cellar/ruby/2.5.1/bin/$(RUBY_BASE_NAME)
--help
--clean
/usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/mkmf.rb:574:in `block in try_compile'
from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/mkmf.rb:521:in `with_werror'
from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/mkmf.rb:574:in `try_compile'
from extconf.rb:138:in `nokogiri_try_compile'
from extconf.rb:162:in `block in add_cflags'
from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/mkmf.rb:632:in `with_cflags'
from extconf.rb:161:in `add_cflags'
from extconf.rb:416:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/myname/.gem/ruby/2.5.1/extensions/x86_64-darwin-17/2.5.0/nokogiri-1.10.4/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/myname/.gem/ruby/2.5.1/gems/nokogiri-1.10.4 for inspection.
Results logged to /Users/myname/.gem/ruby/2.5.1/extensions/x86_64-darwin-17/2.5.0/nokogiri-1.10.4/gem_make.out
An error occurred while installing nokogiri (1.10.4), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.10.4' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
recurring_select was resolved to 2.0.0, which depends on
rails was resolved to 5.0.7.2, which depends on
actioncable was resolved to 5.0.7.2, which depends on
actionpack was resolved to 5.0.7.2, which depends on
actionview was resolved to 5.0.7.2, which depends on
rails-dom-testing was resolved to 2.0.3, which depends on
nokogiri
Joshuas-iMac:momentum-master myname$
```git
Run these commands:
gem uninstall nokogiri
xcode-select --install
gem install nokogiri
source: http://www.nokogiri.org/tutorials/installing_nokogiri.html#mac_os_x
sometimes mac updates can break xcode CLI so reinstalling can fix the issue: https://github.com/sparklemotion/nokogiri/issues/1445
*
https://stackoverflow.com/a/37757604/11544569
*
Im getting the following error message when i do
rails db:schema:dump or any rails command in this directory
Could not find gem 'rails (~> 5.0.1) x86-mingw32' in any of the gem sources listed in your Gemfile or available on this machine.
Run `bundle install` to install missing gems.
i tried bundle install and received the following error message
>C:\Users\jalen\Documents\Sites\simple_cms>gem install rails -v 5.0.1
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
> current directory: C:/Ruby23/lib/ruby/gems/2.3.0/gems/nio4r-1.2.1/ext/nio4r
C:/Ruby23/bin/ruby.exe -r ./siteconf20161220-8320-1xbe7zi.rb extconf.rb
checking for unistd.h... *** 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.
>Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby23/bin/$(RUBY_BASE_NAME)
>C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
>You have to install development tools first.
from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:587:in `try_cpp'
from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:1091:in `block in have_header'
from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in >postpone'
from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:1090:in `have_header'
from extconf.rb:3:in `<main>'
>To see why this extension failed to compile, please check the mkmf.log which can be found here:
>C:/Ruby23/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/nio4r->1.2.1/mkmf.log
>extconf failed, exit code 1
>Gem files will remain installed in C:/Ruby23/lib/ruby/gems/2.3.0/gems/nio4r-1.2.1 for inspection.
Results logged to C:/Ruby23/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/nio4r-1.2.1/gem_make.out
I thought i may be DevKit that was the problem, but I've already installed DevKit on my computer, and when in another directory i can see that i have
rails -v
Rails 5.0.1
I figured out the answer. Make sure that if you download the x64 ruby version, you also download the x64 DevKit installation as well. I didnt pay attention to that and downloaded a x64 with a non x64.
I'm trying to install nokogiri on my machine but I am receiving the following error:
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
current directory: /Users/username/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.6.4/ext/nokogiri
/Users/username/.rbenv/versions/2.0.0-p481/bin/ruby -r ./siteconf20151127-29540-11ahx4h.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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/username/.rbenv/versions/2.0.0-p481/bin/ruby
--help
--clean
/Users/username/.rbenv/versions/2.0.0-p481/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/username/.rbenv/versions/2.0.0-p481/lib/ruby/2.0.0/mkmf.rb:549:in `block in try_compile'
from /Users/username/.rbenv/versions/2.0.0-p481/lib/ruby/2.0.0/mkmf.rb:500:in `with_werror'
from /Users/username/.rbenv/versions/2.0.0-p481/lib/ruby/2.0.0/mkmf.rb:549:in `try_compile'
from extconf.rb:80:in `nokogiri_try_compile'
from extconf.rb:87:in `block in add_cflags'
from /Users/username/.rbenv/versions/2.0.0-p481/lib/ruby/2.0.0/mkmf.rb:599:in `with_cflags'
from extconf.rb:86:in `add_cflags'
from extconf.rb:337:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/username/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/extensions/x86_64-darwin-14/2.0.0-static/nokogiri-1.6.6.4/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/username/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.6.4 for inspection.
Results logged to /Users/username/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/extensions/x86_64-darwin-14/2.0.0-static/nokogiri-1.6.6.4/gem_make.out
I'm unsure how to go about fixing this as I do not have too much experience with setting up native extensions. Any help would be greatly appreciated. Let me know if more information needs to be presented.
This seems to be a common issue. You can check the following link
http://www.nokogiri.org/tutorials/installing_nokogiri.html
You will need to update the Rubygems to 2.4.5 or later and also check whether development tools is installed on you pc.
Or you can do the following if you are using bundle
gem update --system
gem install nokogiri -- --use-system-libraries
bundle config build.nokogiri --use-system-libraries
bundle install
I had to use version 1.6.7.rc4-x64-mingw32 (I'm on Windows). Added this line to my Gemfile:
gem 'nokogiri', '~> 1.6', '>= 1.6.7.rc4'
After combining many solutions from git issues and SO, this worked for me:
gem install nokogiri -v '1.6.7' -n /usr/local/bin -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/
Although I did prepend sudo.
My first step when trying to install the gem puma is to enter gem install puma --version 2.12.3 into my command prompt. Then this error appears. I don't know what to make of it.
C:\Users>gem install puma --version 2.12.3
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing puma:
ERROR: Failed to build gem native extension.
C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20150809-8352-14jkju1.rb extconf.rb
checking for BIO_read() in -lcrypto... no
checking for BIO_read() in -llibeay32... no
*** 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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby22-x64/bin/$(RUBY_BASE_NAME)
--with-puma_http11-dir
--without-puma_http11-dir
--with-puma_http11-include
--without-puma_http11-include=${puma_http11-dir}/include
--with-puma_http11-lib
--without-puma_http11-lib=${puma_http11-dir}/lib
--with-cryptolib
--without-cryptolib
--with-libeay32lib
--without-libeay32lib
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/puma-2
.12.3 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0
/puma-2.12.3/gem_make.out
Once I receive this , I follow these instructions https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows
And I receive this error:
C:\Users>gem install puma -- --with-opt- dir=c:\
openssl
ERROR: Loading command: install (LoadError)
127: The specified procedure could not be found. - C:/Ruby22-x64/lib/r
uby/2.2.0/x64-mingw32/openssl.so
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
Side note: here is the mkmf.log
mkmf.log
Please Help! thanks!
I think I have found answer for your question. Here the link
You must download OpenSSL libraries. There are two types OpenSSL libraries, one for 32bit other for 64bit.
After you installed them run gem install puma -- --with-opt-dir=D:\openssl
--with-opt-dir=D:\openssl is folder direction where you have downloaded libs.
Some tutorials have links to openssl which is for 32bit computers. I realized this after several failures. Then I have downloaded 64 bit version.
I've been trying to get rails working but whatever I do it comes up with this error. So far I've tried to update everything, re install homebrew, and re install ruby. RVM however will not installl
sudo gem install rails
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby 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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--help
--clean
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `block in try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:500:in `with_werror'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `try_compile'
from extconf.rb:77:in `block in add_cflags'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:599:in `with_cflags'
from extconf.rb:76:in `add_cflags'
from extconf.rb:323:in `<main>'
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.5 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.5/ext/nokogiri/gem_make.out
Here you got the error
"You have to install development tools first."
Incase, while trying to update a bundle, you get an error "You have to install development tools first." on OSX ,
If you already have Xcode installed, you can still manually install the development tools via terminal:
xcode-select --install
Your problem will be solved.
Your question fails to specify your development environment. Mac? If so, Have you installed the full XCode from Apple? I see that line that says "install development tools"
Just a follow up ... to help explain
it may be that you are on a mac and rails cannot find the right compiler for c headers.
just install xcode from apps store / homebrew or go to terminal ...
$ xcode-select --install
complete the installation and agree on the licensing etc, then ...
$ sudo gem install rails