1

我正在使用 ruby​​stack2.2.0。当我为使用 bcrypt 的新项目运行 bundle install 时,出现此错误:

使用本机扩展安装 bcrypt 3.1.7

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

这是详细的输出

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

/ws/sachilig-sjc/new/ruby/bin/ruby -r ./siteconf20150709-16222-82kbqs.rb extconf.rb
checking for ruby/util.h... yes
creating Makefile

make "DESTDIR=" clean
Use of uninitialized value in concatenation (.) or string at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
Use of uninitialized value in concatenation (.) or string at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
Use of uninitialized value in concatenation (.) or string at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
Use of uninitialized value in concatenation (.) or string at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
Use of uninitialized value in concatenation (.) or string at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
Use of uninitialized value in concatenation (.) or string at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
Use of uninitialized value in concatenation (.) or string at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
Use of uninitialized value in concatenation (.) or string at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
Use of uninitialized value in pattern match (m//) at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
Argument "UUUUUUUUUUUU" isn't numeric in division (/) at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
Illegal division by zero at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
BEGIN failed--compilation aborted at /ws/sachilig-sjc/new/perl/lib/5.16.3/File/Basename.pm line 52.
Compilation failed in require at /router/bin/make line 37.
BEGIN failed--compilation aborted at /router/bin/make line 37.

make "DESTDIR="
Use of uninitialized value in concatenation (.) or string at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
Use of uninitialized value in concatenation (.) or string at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
Use of uninitialized value in concatenation (.) or string at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
Use of uninitialized value in concatenation (.) or string at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
Use of uninitialized value in concatenation (.) or string at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
Use of uninitialized value in concatenation (.) or string at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
Use of uninitialized value in concatenation (.) or string at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
Use of uninitialized value in concatenation (.) or string at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
Use of uninitialized value in pattern match (m//) at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
Argument "UUUUUUUUUUUU" isn't numeric in division (/) at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
Illegal division by zero at /ws/sachilig-sjc/new/perl/lib/5.16.3/warnings.pm line 390.
BEGIN failed--compilation aborted at /ws/sachilig-sjc/new/perl/lib/5.16.3/File/Basename.pm line 52.
Compilation failed in require at /router/bin/make line 37.
BEGIN failed--compilation aborted at /router/bin/make line 37.

make failed, exit code 255

Gem files will remain installed in /ws/sachilig-sjc/new/ruby/lib/ruby/gems/2.2.0/gems/bcrypt-3.1.7 for inspection.
Results logged to /ws/sachilig-sjc/new/ruby/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.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.
4

2 回答 2

2

它帮助我用我的 rails 应用程序的 Gemfile 替换gem 'bcrypt', '3.1.7'gem 'bcrypt', '~> 3.1.7'

不同之处在于捆绑器可以加载随最后一个(次要)数字变化的任何 gem。

然后我从命令行运行bundle install,它就像奇迹一样工作。

于 2016-06-25T15:15:19.887 回答
1

我相信我有同样的问题,我可能已经解决了 rm -rf Gemfile.lock

,然后从您的 Gemfile 中删除版本信息,然后尝试运行, gem install bcrypt 看看它是否有效......如果是这样: bundle bundle update 如果这不起作用,那么您的ruby -vor版本错误rails -v。在这种情况下,您可能必须rbenv install Ruby这样做gem install Rails。我不确定我对这类事情的确切顺序是什么,但我一直在做这样的事情,最终有些事情让步了。

顺便说一句,你的 ruby​​ 绝对不是 2.2.0 的最新版本,所以你可能想去安装 ruby​​.. https://gorails.com有一些东西。

于 2015-07-10T02:05:58.200 回答