使用rails new blog
构建了一个新的rails项目,并收到错误消息:Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
exist
identical README.rdoc
identical Rakefile
identical config.ru
identical .gitignore
identical Gemfile
exist app
identical app/assets/javascripts/application.js
identical app/assets/stylesheets/application.css
identical app/controllers/application_controller.rb
identical app/helpers/application_helper.rb
identical app/views/layouts/application.html.erb
identical app/assets/images/.keep
identical app/mailers/.keep
identical app/models/.keep
identical app/controllers/concerns/.keep
identical app/models/concerns/.keep
exist bin
identical bin/bundle
identical bin/rails
identical bin/rake
exist config
identical config/routes.rb
identical config/application.rb
identical config/environment.rb
exist config/environments
identical config/environments/development.rb
identical config/environments/production.rb
identical config/environments/test.rb
exist config/initializers
identical config/initializers/backtrace_silencers.rb
identical config/initializers/filter_parameter_logging.rb
identical config/initializers/inflections.rb
identical config/initializers/mime_types.rb
conflict config/initializers/secret_token.rb
Overwrite /Users/jianqiuhuang/Desktop/ruby/blog/config/initializers/secret_token.rb? (enter "h" for help) [Ynaqdh] y
force config/initializers/secret_token.rb
identical config/initializers/session_store.rb
identical config/initializers/wrap_parameters.rb
exist config/locales
identical config/locales/en.yml
identical config/boot.rb
identical config/database.yml
exist db
identical db/seeds.rb
exist lib
exist lib/tasks
identical lib/tasks/.keep
exist lib/assets
identical lib/assets/.keep
exist log
identical log/.keep
exist public
identical public/404.html
identical public/422.html
identical public/500.html
identical public/favicon.ico
identical public/robots.txt
exist test/fixtures
identical test/fixtures/.keep
exist test/controllers
identical test/controllers/.keep
exist test/mailers
identical test/mailers/.keep
exist test/models
identical test/models/.keep
exist test/helpers
identical test/helpers/.keep
exist test/integration
identical test/integration/.keep
identical test/test_helper.rb
exist tmp/cache
exist tmp/cache/assets
exist vendor/assets/javascripts
identical vendor/assets/javascripts/.keep
exist vendor/assets/stylesheets
identical vendor/assets/stylesheets/.keep
run bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.4.2
Using i18n 0.7.0
Using minitest 4.7.5
Using multi_json 1.11.0
Using thread_safe 0.3.5
Using tzinfo 0.3.43
Using activesupport 4.0.0
Using builder 3.1.4
Using erubis 2.7.0
Using rack 1.5.2
Using rack-test 0.6.3
Using actionpack 4.0.0
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.0.0
Using activemodel 4.0.0
Using activerecord-deprecated_finders 1.0.4
Using arel 4.0.2
Using activerecord 4.0.0
Using bundler 1.9.4
Using coffee-script-source 1.9.1.1
Using execjs 2.5.2
Using coffee-script 2.4.1
Using thor 0.19.1
Using railties 4.0.0
Using coffee-rails 4.0.1
Using hike 1.2.3
Using jbuilder 1.5.3
Using jquery-rails 3.1.2
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h
Gem files will remain installed in /var/folders/b0/spcr203s5vgb3f4sd8kfllhc0000gn/T/bundler20150422-979-i48mud/json-1.8.2/gems/json-1.8.2 for inspection.
Results logged to /var/folders/b0/spcr203s5vgb3f4sd8kfllhc0000gn/T/bundler20150422-979-i48mud/json-1.8.2/gems/json-1.8.2/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.8.2), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.2'` succeeds before bundling.
有谁知道问题是什么?
答案 0 :(得分:1)
您可以尝试两件事:
gem install bundler -v '= 1.5.1'
或高于1.5.1的版本rvm reinstall <version>
答案 1 :(得分:0)
您似乎正在尝试在已存在的文件夹上创建新的rails应用,但您不应该这样做。首先删除以前的安装,&#34;博客&#34;文件夹,或选择其他应用名称。
答案 2 :(得分:0)
问题是我安装了最新版本的Xcode,从未打开Xcode来完成安装。 轻松修复:
然后,您可以执行rails new <directory>