当我运行bundle install时,我遇到了bcrypt gem的错误

时间:2014-10-27 15:49:24

标签: ruby-on-rails gem bcrypt

我无法安装bcrypt 我的环境 - Mac Yosemite 10.10,Ruby - 1.9.3 p547,Rails - 3.2.15。 当我运行bundle install时,我会这样。

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/mohit/.rvm/rubies/ruby-1.9.3-p547/bin/ruby extconf.rb 
creating Makefile
make clean
make
compiling bcrypt_ext.c
make: *** [bcrypt_ext.o] Segmentation fault: 11
make failed, exit code 2
Gem files will remain installed in /Users/mohit/.rvm/gems/ruby-1.9.3-p547/gems/bcrypt-3.1.9 for inspection.
Results logged to /Users/mohit/.rvm/gems/ruby-1.9.3-p547/extensions/x86_64-darwin-13/1.9.1/bcrypt-3.1.9/gem_make.out
An error occurred while installing bcrypt (3.1.9), and Bundler cannot continue.
Make sure that `gem install bcrypt -v '3.1.9'` succeeds before bundling.
Like

这是我的Gemfile

source 'https://rubygems.org'

gem 'rails', '3.2.15'


 # Bundle edge Rails instead:

 # gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'



 # Gems used only for assets and not required

 # in production environments by default.

group :assets do

  gem 'sass-rails',   '~> 3.2.3'

  gem 'coffee-rails', '~> 3.2.1'


  # See https://github.com/sstephenson/execjs#readme for more supported runtimes

  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'

end

  #gem 'devise'

gem 'jquery-rails'

gem "sorcery"

 # To use ActiveModel has_secure_password

  gem 'bcrypt-ruby'


 # To use Jbuilder templates for JSON

 # gem 'jbuilder'

 # Use unicorn as the app server

 # gem 'unicorn'


 # Deploy with Capistrano

 # gem 'capistrano'


 # To use debugger

 # gem 'debugger'

3 个答案:

答案 0 :(得分:0)

这是我发现的,当我遇到同样的错误时纠正了我的问题:

xcode-select --install
bundle install

值得注意的是,我也在优胜美地,但Ruby 2.1.3,Rails 4.1.6。

答案 1 :(得分:0)

我通过替换gem'bcrypt'代替gem'bcrypt-ruby'来更改gem文件,并进行了bundle install并为我工作!!

答案 2 :(得分:-1)

最后,我通过从rubygems.org复制bcrypt的确切单词来解决这个问题,然后对名称进行了细微更改,然后我做了bundle install并且它有效。