rails s抛出一个错误extconf失败,退出代码1

时间:2014-12-17 21:14:46

标签: ruby-on-rails ruby-on-rails-4

我跑了' rails s'在rails app文件夹中获取以下内容

extconf failed, exit code 1

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.1.2/gems/debugger-1.6.8 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.1.2/extensions/x86_64-darwin-13/2.1.0-static/debugger-1.6.8/gem_make.out
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:38:in `block in build'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/tempfile.rb:324:in `open'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:17:in `build'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/ext/builder.rb:161:in `block (2 levels) in build_extension'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in `chdir'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in `block in build_extension'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/ext/builder.rb:159:in `synchronize'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/ext/builder.rb:159:in `build_extension'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/ext/builder.rb:198:in `block in build_extensions'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in `each'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in `build_extensions'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/specification.rb:1436:in `block in build_extensions'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/user_interaction.rb:45:in `use_ui'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/specification.rb:1434:in `build_extensions'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/stub_specification.rb:60:in `build_extensions'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/specification.rb:925:in `block in find_inactive_by_path'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/specification.rb:924:in `each'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/specification.rb:924:in `find'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/specification.rb:924:in `find_inactive_by_path'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems.rb:185:in `try_activate'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
    from /usr/local/rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:9:in `<main>'

我不知道如何解决这个问题?

编辑: 所以在我犯错之前用sudo安装了一些宝石

我之前有这个错误

/Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/ext/builder.rb:212:in `initialize': Permission denied @ rb_sysopen - /usr/local/rvm/gems/ruby-2.1.2/extensions/x86_64-darwin-13/2.1.0-static/debugger-1.6.8/gem_make.out (Errno::EACCES)
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/ext/builder.rb:212:in `open'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/ext/builder.rb:212:in `write_gem_make_out'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/ext/builder.rb:132:in `build_error'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/ext/builder.rb:171:in `rescue in build_extension'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/ext/builder.rb:156:in `build_extension'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/ext/builder.rb:198:in `block in build_extensions'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in `each'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in `build_extensions'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/specification.rb:1436:in `block in build_extensions'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/user_interaction.rb:45:in `use_ui'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/specification.rb:1434:in `build_extensions'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/stub_specification.rb:60:in `build_extensions'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/specification.rb:925:in `block in find_inactive_by_path'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/specification.rb:924:in `each'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/specification.rb:924:in `find'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/specification.rb:924:in `find_inactive_by_path'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems.rb:185:in `try_activate'
    from /Users/at/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
    from /Users/a/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
    from /usr/local/rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:9:in `<main>'

所以我跑了

sudo chown -R `whoami`:staff /usr/local/rvm/gems/ruby-2.1.2

然后我尝试使用rbenv修复它并按照说明从在线安装rbenv

ruby -v 
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]

运行rails -v和bundle exec rails会产生与rails

完全相同的错误
 extconf failed, exit code 1
.....

的Gemfile

source 'https://rubygems.org'
ruby '2.1.2'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.1'
gem 'bcrypt',               '3.1.7'
gem 'faker',                '1.4.2'
gem 'will_paginate',           '3.0.7'
gem 'bootstrap-will_paginate', '0.0.10'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'

# Use bootstrap sass
gem 'bootstrap-sass',       '3.2.0.0'

gem 'uglifier',             '2.5.3'
gem 'coffee-rails',         '4.0.1'
gem 'jquery-rails',         '3.1.2'
gem 'turbolinks',           '2.3.0'
gem 'jbuilder',             '2.1.3'
gem 'rails-html-sanitizer', '1.0.1'
gem 'sdoc',                 '0.4.0', group: :doc

group :development, :test do
  gem 'sqlite3',     '1.3.9'
  gem 'byebug',      '3.4.0'
  gem 'web-console', '2.0.0.beta3'
  gem 'spring',      '1.1.3'
end

group :test do
  gem 'minitest-reporters', '1.0.5'
  gem 'mini_backtrace',     '0.1.3'
  gem 'guard-minitest',     '2.3.1'
end

group :production do
  gem 'pg',             '0.17.1'
  gem 'rails_12factor', '0.0.2'
  gem 'unicorn',        '4.8.3'
end

0 个答案:

没有答案