0

您好,我正在尝试从 RailsApps 安装 rails-devise-roles 的入门应用程序。我已经完成了他们之前的基础教程之一,但是已经大约四个月了。我不确定我是否需要更新一些东西。我正在使用带有终端输入的mac。

当我运行这个命令时: ails new rails-devise-roles -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb

我通过了所有提示并开始安装,直到出现此错误:

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

    /Users/suzanne/.rvm/rubies/ruby-2.1.0/bin/ruby extconf.rb 
checking for ruby/util.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

.

这是命令的完整输出。

suzanne$  rails new rails-devise-roles -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb
      create  
      create  README.rdoc
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
      create  app/assets/javascripts/application.js
      create  app/assets/stylesheets/application.css
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/views/layouts/application.html.erb
      create  app/assets/images/.keep
      create  app/mailers/.keep
      create  app/models/.keep
      create  app/controllers/concerns/.keep
      create  app/models/concerns/.keep
      create  bin
      create  bin/bundle
      create  bin/rails
      create  bin/rake
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/secrets.yml
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/cookies_serializer.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/session_store.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  lib
      create  lib/tasks
      create  lib/tasks/.keep
      create  lib/assets
      create  lib/assets/.keep
      create  log
      create  log/.keep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/favicon.ico
      create  public/robots.txt
      create  test/fixtures
      create  test/fixtures/.keep
      create  test/controllers
      create  test/controllers/.keep
      create  test/mailers
      create  test/mailers/.keep
      create  test/models
      create  test/models/.keep
      create  test/helpers
      create  test/helpers/.keep
      create  test/integration
      create  test/integration/.keep
      create  test/test_helper.rb
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor/assets/javascripts
      create  vendor/assets/javascripts/.keep
      create  vendor/assets/stylesheets
      create  vendor/assets/stylesheets/.keep
       apply  https://raw.github.com/RailsApps/rails-composer/master/composer.rb
    composer  
    composer   _____       _ _
    composer  |  __ \     (_) |       /\
    composer  | |__) |__ _ _| |___   /  \   _ __  _ __  ___
    composer  |  _  // _` | | / __| / /\ \ | '_ | '_ \/ __|
    composer  | | \ \ (_| | | \__ \/ ____ \| |_) | |_) \__ \
    composer  |_|  \_\__,_|_|_|___/_/    \_\ .__/| .__/|___/
    composer                               | |   | |
    composer                               | |   | |
    composer  
    composer  Rails Composer, open source, supported by subscribers.
    composer  Please join RailsApps to support development of Rails Composer.
    composer  Need help? Ask on Stack Overflow with the tag 'railsapps.'
    composer  Your new application will contain diagnostics in its README file.
      insert    config/application.rb
      recipe  Running core recipe...
        core  selected all core recipes
      recipe  Running git recipe...
         git  initialize git
      remove    .gitignore
      create    .gitignore
         run    git init from "."
Initialized empty Git repository in /Users/suzanne/Ruby/railsapps/rails-devise-roles/.git/
         run    git add -A from "."
         run    git commit -qm "rails_apps_composer: initial commit" from "."
      recipe  Running railsapps recipe...
      option  Build a starter application?
          1)  Build a RailsApps example application
          2)  Contributed applications (none available)
          3)  Custom application (experimental)
      choose  Enter your selection: 1
      option  Choose a starter application.
          1)  learn-rails
          2)  rails-bootstrap
          3)  rails-foundation
          4)  rails-omniauth
          5)  rails-devise
          6)  rails-devise-roles
          7)  rails-devise-pundit
          8)  rails-signup-download
      choose  Enter your selection: 5
              Get on the mailing list for Rails Composer news?
      option  Enter your email address: 
      recipe  Running learn_rails recipe...
      recipe  Running rails_bootstrap recipe...
      recipe  Running rails_foundation recipe...
      recipe  Running rails_omniauth recipe...
      recipe  Running rails_devise recipe...
      recipe  Running rails_devise_roles recipe...
      recipe  Running rails_devise_pundit recipe...
      recipe  Running rails_signup_download recipe...
      recipe  Running rails_mailinglist_signup recipe...
      recipe  Running setup recipe...
       setup  Your operating system is darwin12.5.0.
       setup  You are using Ruby version 2.1.0.
       setup  You are using Rails version 4.1.0.rc1.
      option  Web server for development?
          1)  WEBrick (default)
          2)  Thin
          3)  Unicorn
          4)  Puma
          5)  Phusion Passenger (Apache/Nginx)
          6)  Phusion Passenger (Standalone)
      choose  Enter your selection: 1
      option  Web server for production?
          1)  Same as development
          2)  Thin
          3)  Unicorn
          4)  Puma
          5)  Phusion Passenger (Apache/Nginx)
          6)  Phusion Passenger (Standalone)
      choose  Enter your selection: 1
      option  Database used in development?
          1)  SQLite
          2)  PostgreSQL
          3)  MySQL
      choose  Enter your selection: 1
      option  Template engine?
          1)  ERB
          2)  Haml
          3)  Slim
      choose  Enter your selection: 1
      option  Test framework?
          1)  None
          2)  RSpec with Capybara
      choose  Enter your selection: 2
       setup  Adding DatabaseCleaner, FactoryGirl, Faker, Launchy, Selenium
      option  Continuous testing?
          1)  None
          2)  Guard
      choose  Enter your selection: 1
      option  Front-end framework?
          1)  None
          2)  Bootstrap 3.0
          3)  Bootstrap 2.3
          4)  Zurb Foundation 5.0
          5)  Zurb Foundation 4.0
          6)  Simple CSS
      choose  Enter your selection: 2
       setup  The Devise 'forgot password' feature requires email.
      option  Add support for sending email?
          1)  None
          2)  Gmail
          3)  SMTP
          4)  SendGrid
          5)  Mandrill
      choose  Enter your selection: 2
      option  Devise modules?
          1)  Devise with default modules
          2)  Devise with Confirmable module
          3)  Devise with Confirmable and Invitable modules
      choose  Enter your selection: 1
      option  Use a form builder gem?
          1)  None
          2)  SimpleForm
      choose  Enter your selection: 1
      create    README
      append    README
      recipe  Running locale recipe...
      recipe  Running readme recipe...
      recipe  Running gems recipe...
      insert    Gemfile
        gsub    Gemfile
        gsub    Gemfile
        gsub    Gemfile
        gsub    Gemfile
         run    git add -A from "."
         run    git commit -qm "rails_apps_composer: Gemfile" from "."
      recipe  Running tests recipe...
      recipe  Running email recipe...
      recipe  Running devise recipe...
      recipe  Running omniauth recipe...
      recipe  Running roles recipe...
      recipe  Running frontend recipe...
      recipe  Running pages recipe...
      recipe  Running init recipe...
      recipe  Running analytics recipe...
      option  Install page-view analytics?
          1)  None
          2)  Google Analytics
          3)  Segment.io
      choose  Enter your selection: 1
      recipe  Running deployment recipe...
      recipe  Running extras recipe...
      option  Set a robots.txt file to ban spiders? (y/n) n
      option  Create a GitHub repository? (y/n) n
      option  Use or create a project-specific rvm gemset? (y/n) y
      extras  recipe creating project-specific rvm gemset and .rvmrc
      extras  creating RVM gemset 'rails-devise-roles'
      extras  switching to gemset 'rails-devise-roles'
WARN: Unresolved specs during Gem::Specification.reset:
      minitest (~> 5.1)
      builder (~> 3.1)
      rake (>= 0.8.7)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
      create    .ruby-version
      create    .ruby-gemset
      extras  recipe setting quiet_assets for reduced asset pipeline logging
      extras  recipe adding better_errors gem
    composer  Installing gems. This will take a while.
         run    bundle install --without production from "."
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Using rake (10.3.2)
Using i18n (0.6.11)
Using json (1.8.1)
Using minitest (5.4.1)
Using thread_safe (0.3.4)
Using tzinfo (1.2.2)
Using activesupport (4.1.0.rc1)
Using builder (3.2.2)
Using erubis (2.7.0)
Using actionview (4.1.0.rc1)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.1.0.rc1)
Using mime-types (1.25.1)
Using polyglot (0.3.5)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.1.0.rc1)
Using activemodel (4.1.0.rc1)
Using arel (5.0.1.20140414130214)
Using activerecord (4.1.0.rc1)
Using addressable (2.3.6)

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

    /Users/suzanne/.rvm/rubies/ruby-2.1.0/bin/ruby extconf.rb 
checking for ruby/util.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=/Users/suzanne/.rvm/rubies/ruby-2.1.0/bin/ruby
/Users/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.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/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'
    from /Users/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:1067:in `block in have_header'
    from /Users/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
    from /Users/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
    from /Users/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:321:in `open'
    from /Users/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
    from /Users/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:321:in `open'
    from /Users/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
    from /Users/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
    from /Users/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:1066:in `have_header'
    from extconf.rb:14:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/suzanne/.rvm/gems/ruby-2.1.0@rails-devise-roles/gems/bcrypt-3.1.7 for inspection.
Results logged to /Users/suzanne/.rvm/gems/ruby-2.1.0@rails-devise-roles/extensions/x86_64-darwin-12/2.1.0-static/bcrypt-3.1.7/gem_make.out

An error occurred while installing bcrypt (3.1.7), and Bundler cannot continue.
Make sure that `gem install bcrypt -v '3.1.7'` succeeds before bundling.
    composer  Updating gem paths.
    composer  Stage Two (running recipe 'stage_two' callbacks).
locale
gems
        gems  recipe stage two
        gems  configuring database
         run    bundle exec rake db:create:all from "."
Could not find gem 'rails (= 4.1.0.rc1) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
         run    git add -A from "."
         run    git commit -qm "rails_apps_composer: create database" from "."
gems
        gems  recipe stage two
        gems  running generators
         run    git add -A from "."
         run    git commit -qm "rails_apps_composer: generators" from "."
# On branch master
nothing to commit, working directory clean
tests
       tests  recipe stage two
       tests  recipe installing RSpec
    generate    testing:configure rspec -f
Could not find gem 'rails (= 4.1.0.rc1) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
         run    git add -A from "."
         run    git commit -qm "rails_apps_composer: testing framework" from "."
# On branch master
nothing to commit, working directory clean
email
       email  recipe stage two
      insert    config/environments/development.rb
      insert    config/environments/production.rb
        gsub    config/environments/production.rb
      insert    config/environments/development.rb
      insert    config/environments/production.rb
         run    git add -A from "."
         run    git commit -qm "rails_apps_composer: set email accounts" from "."
devise
      devise  recipe stage two
        gsub    config/initializers/filter_parameter_logging.rb
    generate    devise:install
Could not find gem 'rails (= 4.1.0.rc1) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
    generate    devise user
Could not find gem 'rails (= 4.1.0.rc1) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
    generate    migration AddNameToUsers name:string
Could not find gem 'rails (= 4.1.0.rc1) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
         run    bundle exec rake db:migrate from "."
Could not find gem 'rails (= 4.1.0.rc1) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
         run    git add -A from "."
         run    git commit -qm "rails_apps_composer: devise" from "."
omniauth
    omniauth  recipe stage two
         run    git add -A from "."
         run    git commit -qm "rails_apps_composer: omniauth" from "."
# On branch master
nothing to commit, working directory clean
roles
       roles  recipe stage two
         run    git add -A from "."
         run    git commit -qm "rails_apps_composer: add roles to a User model" from "."
# On branch master
nothing to commit, working directory clean
frontend
    frontend  recipe stage two
    generate    layout:install bootstrap3 -f
Could not find gem 'rails (= 4.1.0.rc1) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
         run    git add -A from "."
         run    git commit -qm "rails_apps_composer: front-end framework" from "."
# On branch master
nothing to commit, working directory clean
pages
       pages  recipe stage two
    generate    pages:users -f
Could not find gem 'rails (= 4.1.0.rc1) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
    generate    layout:navigation -f
Could not find gem 'rails (= 4.1.0.rc1) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
         run    git add -A from "."
         run    git commit -qm "rails_apps_composer: add pages" from "."
# On branch master
nothing to commit, working directory clean
analytics
   analytics  recipe stage two
         run    git add -A from "."
         run    git commit -qm "rails_apps_composer: add analytics" from "."
# On branch master
nothing to commit, working directory clean
    composer  Stage Three (running recipe 'stage_three' callbacks).
readme
      readme  recipe stage three
      remove    README
      remove    README.rdoc
      remove    doc/README_FOR_APP
      create    README
      append    README
      append    README
      create    public/humans.txt
      create    README.md
      append    README.md
         run    git add -A from "."
         run    git commit -qm "rails_apps_composer: add README files" from "."
tests
       tests  recipe stage three
    generate    testing:configure devise -f
Could not find gem 'rails (= 4.1.0.rc1) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
init
        init  recipe stage three
      insert    config/secrets.yml
      insert    config/secrets.yml
      insert    config/secrets.yml
      insert    config/secrets.yml
      insert    config/secrets.yml
      insert    config/secrets.yml
      insert    config/secrets.yml
        gsub    config/initializers/devise.rb
The template [https://raw.github.com/RailsApps/rails-composer/master/composer.rb] could not be loaded. Error: No such file or directory @ rb_sysopen - /Users/suzanne/Ruby/railsapps/rails-devise-roles/config/initializers/devise.rb
suzannes-macbook-pro:railsapps suzanne$ bundle install
Bundler::GemfileNotFound
suzannes-macbook-pro:railsapps suzanne$ 

当我尝试运行“捆绑安装”时出现此错误

   Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Using rake (10.3.2)
Using i18n (0.6.11)
Using json (1.8.1)
Using minitest (5.4.1)
Using thread_safe (0.3.4)
Using tzinfo (1.2.2)
Using activesupport (4.1.0.rc1)
Using builder (3.2.2)
Using erubis (2.7.0)
Using actionview (4.1.0.rc1)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.1.0.rc1)
Using mime-types (1.25.1)
Using polyglot (0.3.5)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.1.0.rc1)
Using activemodel (4.1.0.rc1)
Using arel (5.0.1.20140414130214)
Using activerecord (4.1.0.rc1)
Using addressable (2.3.6)

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

    /Users/suzanne/.rvm/rubies/ruby-2.1.0/bin/ruby extconf.rb 
checking for ruby/util.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=/Users/suzanne/.rvm/rubies/ruby-2.1.0/bin/ruby
/Users/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.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/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'
    from /Users/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:1067:in `block in have_header'
    from /Users/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
    from /Users/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
    from /Users/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:321:in `open'
    from /Users/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
    from /Users/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:321:in `open'
    from /Users/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
    from /Users/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
    from /Users/suzanne/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:1066:in `have_header'
    from extconf.rb:14:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/suzanne/.rvm/gems/ruby-2.1.0@rails-devise-roles/gems/bcrypt-3.1.7 for inspection.
Results logged to /Users/suzanne/.rvm/gems/ruby-2.1.0@rails-devise-roles/extensions/x86_64-darwin-12/2.1.0-static/bcrypt-3.1.7/gem_make.out

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

当我运行 gem install bcrypt -v '3.1.7' 时,它只是挂起并且没有发生任何事情。

感谢您的任何建议。

4

0 回答 0