為什麼我無法安裝 bcrypt?

為什麼我無法安裝 bcrypt?

我有一個問題:當我嘗試使用命令“bundle install”安裝一些 Gem 時,我收到以下輸出:

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

/usr/bin/ruby2.1 -r ./siteconf20141210-5447-g6skes.rb extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.1.0/gems/bcrypt-3.1.7 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/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.

為什麼?我該如何解決它?

答案1

在最近的版本中bcrypt-ruby似乎使用了 GMP 庫。

像這樣的事情應該有幫助:

sudo aptitude install libgmp-dev

不要忘記安裝所有用於開發的東西:

sudo aptitude install build-essential

相關內容