I'm working on a Ruby on Rails application with sqlite3 and when I run bundle install, I have this error:
Installing sqlite3 1.3.11 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /tmp/bundler20160411-6894-186xx7csqlite3-1.3.11/gems/sqlite3-1.3.11/ext/sqlite3/usr/bin/ruby1.9.1 -r ./siteconf20160411-6894-cji211.rb extconf.rb
/usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- mkmf (LoadError)
from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from extconf.rb:3:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /tmp/bundler20160411-6894-186xx7csqlite3-1.3.11/gems/sqlite3-1.3.11 for inspection.
Results logged to /tmp/bundler20160411-6894-186xx7csqlite3-1.3.11/extensions/x86_64-linux/1.9.1/sqlite3-1.3.11/gem_make.out
Using erubis 2.6.6
Using activemodel 3.0.5
Using rack-mount 0.6.14
Using rack-test 0.5.7
Using treetop 1.4.15
An error occurred while installing sqlite3 (1.3.11), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.11'` succeeds before bundling.
Gemfile
source 'http://rubygems.org'
gem 'rails', '3.0.5'
gem 'sqlite3-ruby', '1.3.2', :require => 'sqlite3'
Any ideas how I can fix this?
You need to install sqlite3 first sudo apt-get install libsqlite3-dev
Have you tried googling your error?
Here's an answer to the same error you're getting.
Unable to install gem - Failed to build gem native extension - cannot load such file -- mkmf (LoadError)
The solution is not with sqlite3. It's most likely your -dev package. If you're on Linux try this -
sudo apt-get install ruby-dev
For Mac, try this
brew install ruby-dev
Related
Okay so I'm trying to install the gem bootstrap-sass in my ruby on rails app but getting this error.
I followed the basic steps by pasting $ gem 'bootstrap-sass' and $ gem 'autoprefixer-rails' into the gemfile and runnig bndle install in the terminal. My laptop is running on ubuntu 18.04 if that might be causing issue.
Installing autoprefixer-rails 9.6.1
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Fetching ffi 1.11.1
Installing ffi 1.11.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/tmp/bundler20190706-4690-hktydzffi-1.11.1/gems/ffi-1.11.1/ext/ffi_c
/usr/bin/ruby2.5 -r ./siteconf20190706-4690-tr7q8y.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/bundler20190706-4690-hktydzffi-1.11.1/gems/ffi-1.11.1 for inspection.
Results logged to
/tmp/bundler20190706-4690-hktydzffi-1.11.1/extensions/x86_64-linux/2.5.0/ffi-1.11.1/gem_make.out
An error occurred while installing ffi (1.11.1), and Bundler cannot
continue.
Make sure that `gem install ffi -v '1.11.1'` succeeds before bundling.
In Gemfile:
bootstrap-sass was resolved to 3.4.1, which depends on
sassc was resolved to 2.0.1, which depends on
ffi
gem 'bootstrap-sass', '3.3.7'
repelce
gem 'bootstrap-sass'.
because bootstrap-sass was 3.4.1 too higher.
$ bundle install
Errno::ENOENT: No such file or directory # rb_sysopen - /Users/Sean/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/eventmachine-1.0.3/ext/gem_make.out
An error occurred while installing eventmachine (1.0.3), and Bundler cannot
continue.
Make sure that `gem install eventmachine -v '1.0.3'` succeeds before bundling.
$ gem list
eventmachine (1.0.3 x86-mingw32)
$ gem build eventmachine -v 1.0.3
ERROR: While executing gem ... (Gem::CommandLineError)
Too many gem names (eventmachine, 1.0.3); please specify only one
Try to edit Gemfile.lock and change eventmachive version from 1.0.3 to 1.0.4.
This works for me.
bundle update
bundle install Hope this will work.
I had a similar issue with eventmachine -v '1.0.4' and i resolved it like this.
gem install eventmachine -v '1.0.4' -- --with-cppflags=-I/usr/local/opt/openssl/include
I want to integrate twitter-boostrap in my Ruby on Rails project.
For that i have written- gem "therubyracer" gem "less-rails" gem "twitter-bootstrap-rails" on my gemfile. And then bundle install in rails command prompt.
After installing less-rails. This error is comming
Gem::Installer::ExtensionBuildError: ERROR:
Failed to build gem native extension`
c:/row/Ruby200/bin/ruby.exe extconf.rb`
creating Makefile
The system cannot find the path specified.
The system cannot find the path specified.`
c:/row/Ruby200/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.3/ext/libv8/builder.rb:58:
in `setup_python!': libv8 requires python 2 to be installed in order to build, b
ut it is currently not available (RuntimeError)
from c:/row/Ruby200/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.3/ext/libv8/builder.rb:42:in `block in build_libv8!'
from c:/row/Ruby200/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.3/ext/libv8/builder.rb:40:in `chdir'
from c:/row/Ruby200/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.3/ext/libv8/builder.rb:40:in `build_libv8!'
from c:/row/Ruby200/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.3/ext/libv8/location.rb:24:in `install!'
from extconf.rb:7:in `<main>'
Gem files will remain installed in c:/row/Ruby200/lib/ruby/gems/2.0.0/gems/libv8 -3.16.14.3 for inspection.
Results logged to c:/row/Ruby200/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.3/ext/libv8/gem_make.out
An error occurred while installing libv8 (3.16.14.3), and Bundler cannotcontinue.
Make sure that `gem install libv8 -v '3.16.14.3'` succeeds before bundling.
Help. thanks
Remove
group :assets do
end
But keep gems mentioned inside this group, then do bundle install.
gem 'therubyracer', :platforms => :ruby
gem 'less-rails'
gem 'devise'
I'm getting this error when I try to bundle install
Bundler::GemspecError: Could not read gem at /home/theareba/.rvm/gems/ruby-2.0.0-p353/cache/nokogiri-1.6.1.gem. It may be corrupted.
An error occurred while installing nokogiri (1.6.1), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.6.1'` succeeds before bundling.
I've tried removing nokogiri in the cache and bundle installing again in vain.
Here's my gemfile
source 'https://rubygems.org'
gem 'rails', '4.0.0'
ruby "2.0.0"
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '2-1-stable'
gem 'spree', github: 'spree/spree', branch: '2-1-stable'
gem 'bootstrap-sass', '2.3.2.0'
gem 'sass-rails'
gem 'uglifier'
gem 'coffee-rails'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder'
group :development, :test do
gem 'turn', :require => false
gem 'sqlite3'
gem 'taps', :require => false
gem 'rspec-rails'
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor'
end
UPDATE
Error that occurs when I run gem install nokogiri -v '1.6.0'
Fetching: mini_portile-0.5.2.gem (100%)
Fetching: nokogiri-1.6.0.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:5:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/nokogiri-1.6.0 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/nokogiri-1.6.0/ext/nokogiri/gem_make.out
Note: I've installed both libxslt1-dev and libxml2-dev that are requirements in nokogiri installation.
I've also tried gem install nokogiri -v '1.6.1' but it still fails. I've installed nokogiri -v 1.5.0 in another app so I tried it in this app and got the error that spree requires nokogiri version 1.6.0 or greater. I'm I missing something?
So here's what solved my problem. I created a new gemset i.e
rvm gemset create nokogiri
rvm use ruby-2.0.0-p353#nokogiri
Note: I'm using rvm and ruby 2.0.0. Then I made sure I've got necessary lib installed by running
sudo apt-get install libxml2-dev libxslt-dev
The libraries happened to be already installed. Then I installed nokogiri
gem install nokogiri -v '1.6.1'
It installed successfully. And finally ran bundle install to get all my gems. Hope this helps anyone having the same issue.
Check the RVM gemset. I fixed it by restoring the gemset. If you try upgrading to 4.0.2? I used Nokogiri 1.6.1 with Ruby 2.0.0 and Rails 4.0.2
try this
sudo apt-get install ruby-dev
sudo apt-get install libxml2 libxml2-dev libxslt1-dev
and reinstall nokogiri
sudo gem install nokogiri
When I run bundle install I get
An error occurred while installing libv8 (3.11.8.17), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.11.8.17'` succeeds before bundling.
Libv8 is dependency for lunchy and therubyracer gems.
I have locked in my Gemfile.lock libv8 gem on 3.11.8.17
But I found that I can downgrade it to 3.3.10.4
bundle install / update: libv8 (therubyracer) installation fails (with native extensions)
How to do that?
I also found working 3.11.8.17 gem but don't know how to implement it on my system.
https://github.com/cowboyd/libv8/issues/107#issuecomment-26146673
You can actually install that version on Mavericks:
gem install libv8 -v 3.11.8.17 -- --with-system-v8
I can confirm this works with rbenv and ruby 1.9.3p448
See a similar thread here Installing libv8 gem on OS X 10.9+
You need to reinstall libv8
$ gem uninstall libv8
$ brew install v8
$ gem install therubyracer
Try with
gem "therubyracer", "~> 0.10.2" to Gemfile
And it will install dependent gem libv8 (3.3.10.4) and the issue of build gem native extension failure got resolve.
try upgrading your ruby to the highest patch level. libv8 and the rubyracer gem installed right away after I upgraded ruby-1.8.7 after going from p357 to p375.
Follow the below commands, this will solve the problem for sure:
gem install rmagick -v '2.13.2'
and then do:
gem install libv8 -v 3.11.8.17 -- --with-system-v8