错误安装bcyrpt - 红宝石宝石包(Error installing bcyrpt-ruby

2019-09-23 17:27发布

我试图安装图谋宝石,运行bundle install ,然后让带bcrypt-红宝石这个错误,我以前没有。 我能做什么?

Installing bcrypt-ruby (3.0.1) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb 
creating Makefile

make
xcrun cc -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common   -c bcrypt_ext.c
Error: No developer directory found at /Developer. Run /usr/bin/xcode-select to update the developer directory path.
make: *** [bcrypt_ext.o] Error 1


Gem files will remain installed in /Users/Fryed/.bundler/tmp/25124/gems/bcrypt-ruby-3.0.1 for inspection.
Results logged to /Users/Fryed/.bundler/tmp/25124/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out
An error occured while installing bcrypt-ruby (3.0.1), and Bundler cannot continue.
Make sure that `gem install bcrypt-ruby -v '3.0.1'` succeeds before bundling.

好了,所以我需要安装bcrypt-ruby的...

wpub-6-65:treebook Fryed$ sudo gem install bcrypt-ruby -v '3.0.1'
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing bcrypt-ruby:
    ERROR: Failed to build gem native extension.

        /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
creating Makefile

make
xcrun cc -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common   -c bcrypt_ext.c
Error: No developer directory found at /Developer. Run /usr/bin/xcode-select to update the developer directory path.
make: *** [bcrypt_ext.o] Error 1


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/bcrypt-ruby-3.0.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out

Answer 1:

要么你还没有安装的XCode或您的开发目录配置不正确。

如果第一,尝试安装的XCode。

如果第二,试试这个(或一些变化,不同的地方Xcode的目录)

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer


Answer 2:

gem 'bcrypt-ruby', '~>3.0.1', :github => 'rking/bcrypt-ruby'

bcrypt-红宝石rking的叉注释掉失败的C语言编译补丁3.0.1。 Bcrypt - 红宝石一年前固定的这个问题,但不适用于3.0.1版本,这似乎是你的Rails应用程序需要的依赖。

在Github上查看问题: https://github.com/bundler/bundler/issues/2410



文章来源: Error installing bcyrpt-ruby gem bundle