我跑的时候
控制台中的rails s
,命令失败,我得到了这个回复:
Could not find nokogiri-1.6.8.1 in any of the sources
Run bundle install to install missing gems.
这里的第一个问题是nokogiri不在我的Gemfile中因为我没有使用nokogiri,所以为什么nokogiri是一个问题,因为它甚至不是我运行bundle install的项目的一部分?
然后我根据初始提示运行bundle install:
bundle install
我收到错误。最后的错误消息:
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.
我注意到在整个过程中我得到了其他错误:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
那么,这是我项目中Gemfile的问题还是更深层次的问题?这意味着Gems在我的计算机中的安装方式?
这是我的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
这是我跑完后得到的完整回复:
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.
答案 0 :(得分:1)
好的,感谢您使用捆绑输出更新您的问题。问题是您没有安装xcode的命令行工具。
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
要修复它,只需在命令行中运行:
xcode-select --install
这应该解决它。