我正在使用rubystack2.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.
答案 0 :(得分:1)
我相信我有同样的问题,我可能已经解决了它
rm -rf Gemfile.lock
,然后从Gemfile中删除版本信息,然后尝试运行
gem install bcrypt
看看是否有效...如果是的话:
bundle
bundle update
如果这不起作用,那么您的ruby -v
或rails -v
版本错误。在这种情况下,您可能需要rbenv install Ruby
,然后gem install Rails
。
我不确定我的事件的确切顺序是什么,但是我一直在做这样的事情,最终还是有所收获。
顺便说一句,你的ruby肯定不是最新的2.2.0,所以你可能想去安装ruby .. https://gorails.com有一些东西。
答案 1 :(得分:1)
它帮助我在我的rails应用程序的Gemfile中用gem 'bcrypt', '3.1.7'
替换gem 'bcrypt', '~> 3.1.7'
。
不同之处在于捆绑器可以加载任何随最后(次要)编号而变化的宝石。
然后我从命令行运行bundle install
,它就像奇迹一样。