简体   繁体   中英

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

am learning rails using this website http://tutorials.jumpstartlab.com/projects/blogger.html and whenever I try starting the server using rails server, I get this error on the terminal

Could not find gem 'sqlite3 (>= 0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.

After running the command bundle install , I get the error:

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

    /usr/local/Cellar/ruby/2.1.2_3/bin/ruby extconf.rb
/Users/andrewmolo/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:71:in `initialize': Permission denied @ rb_sysopen - /usr/local/Cellar/ruby/2.1.2_3/bin/rake (Errno::EACCES)
    from /Users/UserX/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:71:in `open'
    from /Users/UserX/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:71:in `block in try_to_fix_binstubs'
    from /Users/UserX/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:69:in `map'
    from /Users/UserX/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:69:in `try_to_fix_binstubs'
    from /Users/UserX/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:46:in `block in execute_no_wrapper'
    from /Users/UserX/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:44:in `each'
    from /Users/UserX/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:44:in `execute_no_wrapper'
    from extconf.rb:19:in `<main>'
bundler 1.9.1
erubis 2.7.0
executable-hooks 1.3.2
nokogiri 1.6.6.2
rack 1.6.0
railties 4.2.1
rake 10.1.0

extconf failed, exit code 1


Gem files will remain installed in /Users/UserX/.rvm/gems/ruby-2.2.0@global/gems/executable-hooks-1.3.2 for inspection.
Results logged to /Users/UserX/.rvm/gems/ruby-2.2.0@global/extensions/x86_64-darwin-13/2.1.0/executable-hooks-1.3.2/gem_make.out

    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/ext/builder.rb:89:in `run'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:38:in `block in build'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/tempfile.rb:324:in `open'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:17:in `build'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/ext/builder.rb:161:in `block (2 levels) in build_extension'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in `chdir'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in `block in build_extension'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/ext/builder.rb:159:in `build_extension'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/ext/builder.rb:198:in `block in build_extensions'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in `each'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in `build_extensions'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/specification.rb:1436:in `block in build_extensions'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/user_interaction.rb:45:in `use_ui'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/specification.rb:1434:in `build_extensions'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/stub_specification.rb:60:in `build_extensions'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/specification.rb:925:in `block in find_inactive_by_path'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/specification.rb:924:in `each'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/specification.rb:924:in `find'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/specification.rb:924:in `find_inactive_by_path'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems.rb:185:in `try_activate'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
    /Users/UserX/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.9.1/lib/bundler/vendor/net/http/persistent.rb:12:in `<top (required)>'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    /Users/UserX/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.9.1/lib/bundler/vendored_persistent.rb:11:in `<top (required)>'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    /usr/local/Cellar/ruby/2.1.2_3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    /Users/UserX/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.9.1/lib/bundler/fetcher.rb:1:in `<top (required)>'
    /Users/UserX/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.9.1/lib/bundler/cli/install.rb:72:in `run'
    /Users/UserX/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.9.1/lib/bundler/cli.rb:157:in `install'
    /Users/UserX/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.9.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
    /Users/UserX/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.9.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
    /Users/UserX/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.9.1/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
    /Users/UserX/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.9.1/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
    /Users/UserX/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.9.1/lib/bundler/cli.rb:10:in `start'
    /Users/UserX/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.9.1/bin/bundle:20:in `block in <top (required)>'
    /Users/UserX/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.9.1/lib/bundler/friendly_errors.rb:7:in `with_friendly_errors'
    /Users/UserX/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.9.1/bin/bundle:18:in `<top (required)>'
    /usr/local/bin/bundle:23:in `load'
    /usr/local/bin/bundle:23:in `<main>'

Environment

Bundler   1.9.1
Rubygems  2.2.2
Ruby      2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
GEM_HOME  /Users/andrewmolo/.rvm/gems/ruby-2.2.0
GEM_PATH  /Users/andrewmolo/.rvm/gems/ruby-2.2.0:/Users/andrewmolo/.rvm/gems/ruby-2.2.0@global
RVM       1.26.10 (latest)
Git       1.8.5.2
rubygems-bundler (1.4.4)

OS = Mavericks 10.9.5

I don't know if this will help people with this issue but I was having the same error. What I ended up doing to fix it is commenting out the sqlite gem in my gemfile for the app. Granted I just did this a few minutes ago so I don't know if I'll run into any other issues but I use Postgres so if you use something else too, there shouldn't be an issue. Hope this helps others like me that were looking for answers.

Looks like bundler has no permission to write into your file system.

Permission denied @ rb_sysopen - /usr/local/Cellar/ruby/2.1.2_3/bin/rake (Errno::EACCES)

Try running your command as sudo:

sudo bundle install 

I believe the issue is the Gemfile.lock thats not allowing you to use the latest version of of each of your gems.

To update your Gemfile.lock run the command:

bundle update 

in the same directory as your Gemfile.lock file then try bundle install again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM