Ruby error when running bundle install

5.5k views Asked by At

When I run rails s in the console, command fails and I get this response:

Could not find nokogiri-1.6.8.1 in any of the sources Run bundle install to install missing gems.

First issue here is that nokogiri is not in my Gemfile because I'm not using nokogiri, so why is nokogiri an issue when it's not even part of the project where I'm running bundle install?

Then I run bundle install according to the initial prompt:

bundle install

I get an error. The final error message:

An error occurred while installing byebug (9.0.6), and Bundler cannot continue. Make sure that gem install byebug -v '9.0.6' succeeds before bundling.

I noticed that throughout I get other errors that say:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

So, is this a problem with the Gemfile in my project or is it a deeper issue? Meaning the way the Gems are installed in my computer?

This is my Gemfile:

source "https://rubygems.org"
ruby "2.3.0"

gem "paperclip"
# Amazon web services
gem 'aws-sdk', '~> 2'

gem 'rails-erd'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
gem 'materialize-sass'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'hirb'
gem 'jquery-ui-rails'
# Use jquery as the JavaScript library
gem 'jquery-rails', '~> 2.2.2'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

gem 'activerecord-reset-pk-sequence'

gem 'acts-as-taggable-on'

gem 'simple_form'

gem 'rails_autolink'

gem 'perfect-scrollbar-rails'

gem 'rails_12factor'

gem 'pundit'

gem 'figaro'

# Use ActiveModel has_secure_password

# Use Unicorn as the app server
# gem 'unicorn'

group :production do
  gem 'pg'
  gem 'bcrypt'
  gem 'whenever', require: false

end

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
  #testing
  gem 'capybara'
  gem 'rspec-rails'
  # Use sqlite3 as the database for Active Record
  gem 'sqlite3'
  gem "nifty-generators"
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

gem 'mocha', group: :test

This is the full response I get after running:

bundle install

Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Using rake 12.0.0
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.10.1
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using rack 1.6.5
Using mime-types-data 3.2016.0521
Using arel 6.0.3
Using activerecord-reset-pk-sequence 0.2.1
Using public_suffix 2.0.4
Using aws-sigv4 1.0.0
Using jmespath 1.3.1
Using bcrypt 3.1.11
Using debug_inspector 0.0.2
Installing byebug 9.0.6 with native extensions
Using choice 0.2.0
Using chronic 0.10.2
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using thor 0.19.4
Using concurrent-ruby 1.0.2
Using diff-lcs 1.2.5
Using hirb 0.7.3
Using multi_json 1.12.1
Using sass 3.4.22
Using metaclass 0.0.4
Using mimemagic 0.3.2
Using nifty-generators 0.4.6
Installing pg 0.19.0 with native extensions
Using bundler 1.13.6
Using ruby-graphviz 1.2.2
Using rails_serve_static_assets 0.0.5
Using rails_stdout_logging 0.0.5
Using rdoc 4.3.0
Using rspec-support 3.5.0
Using tilt 2.0.5
Installing sqlite3 1.3.12 with native extensions
Using turbolinks-source 5.0.0
Using tzinfo 1.2.2
Installing nokogiri 1.6.8.1 with native extensions
Using rack-test 0.6.3
Using mime-types 3.1
Using addressable 2.5.0
Using aws-sdk-core 2.6.38
Using binding_of_caller 0.7.2
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/lib/ruby/gems/2.3.0/gems/byebug-9.0.6/ext/byebug
/usr/local/opt/ruby/bin/ruby -r ./siteconf20161217-12309-210wge.rb extconf.rb
creating Makefile

current directory: /usr/local/lib/ruby/gems/2.3.0/gems/byebug-9.0.6/ext/byebug
make "DESTDIR=" clean
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at:
/Library/Developer/CommandLineTools/usr/bin/xcrun

current directory: /usr/local/lib/ruby/gems/2.3.0/gems/byebug-9.0.6/ext/byebug
make "DESTDIR="
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at:
/Library/Developer/CommandLineTools/usr/bin/xcrun

make failed, exit code 1

Gem files will remain installed in /usr/local/lib/ruby/gems/2.3.0/gems/byebug-9.0.6 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0/byebug-9.0.6/gem_make.out

An error occurred while installing byebug (9.0.6), and Bundler cannot continue.
Make sure that `gem install byebug -v '9.0.6'` succeeds before bundling.
1

There are 1 answers

0
Alexander Luna On

Ok, thank you for updating your question with the bundle output. The problem is that you don't have xcode's command line tools installed.

    current directory: /usr/local/lib/ruby/gems/2.3.0/gems/byebug-9.0.6/ext/byebug
make "DESTDIR=" clean
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at:
/Library/Developer/CommandLineTools/usr/bin/xcrun

current directory: /usr/local/lib/ruby/gems/2.3.0/gems/byebug-9.0.6/ext/byebug
make "DESTDIR="
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at:
/Library/Developer/CommandLineTools/usr/bin/xcrun

make failed, exit code 1

To fix it just run in your command line:

xcode-select --install

This should fix it.