"bcrypt" gem "nokogi-6ren">
gpt4 book ai didi

ruby-on-rails - 无法安装 gem - 无法构建 gem native 扩展 - 无法加载此类文件 -- mkmf (LoadError)

转载 作者:数据小太阳 更新时间:2023-10-29 06:16:52 25 4
gpt4 key购买 nike

ruby 1.9.3

Gemfile部分

#...............
gem "pony"
gem "bcrypt-ruby", :require => "bcrypt"
gem "nokogiri"
#..................

当我尝试安装 gems 时,出现错误

alex@ubuntu:~/$ bundle
Fetching gem metadata from http://rubygems.org/.........
Fetching gem metadata from http://rubygems.org/..
Enter your password to install the bundled RubyGems to your system:
#####............................................................
Installing bcrypt-ruby (3.0.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:36:in `<main>'


Gem files will remain installed in /home/alex/.bundler/tmp/5526/gems/bcrypt-ruby-3.0.1 for inspection.
Results logged to /home/alex/.bundler/tmp/5526/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out
An error occurred 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.

那我就这样

sudo gem install bcrypt-ruby -v '3.0.1'
Building native extensions. This could take a while...
ERROR: Error installing bcrypt-ruby:
ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:36:in `<main>'


Gem files will remain installed in /var/lib/gems/1.9.1/gems/bcrypt-ruby-3.0.1 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out

也出现错误。

我错过了什么?

最佳答案

还有类似的问题:

通常,解决方案是:

sudo apt-get install ruby-dev

或者,如果这不起作用,根据您的 ruby​​ 版本,运行如下命令:

sudo apt-get install ruby1.9.1-dev

应该可以解决您的问题。


还是不行?安装 ruby​​-dev 后尝试以下操作:

sudo apt-get install make

关于ruby-on-rails - 无法安装 gem - 无法构建 gem native 扩展 - 无法加载此类文件 -- mkmf (LoadError),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13767725/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com