gem을 설치할 수 없음-gem 기본 확장을 빌드하지 못했습니다-해당 파일을로드 할 수 없습니다 — mkmf (LoadError)
루비 1.9.3
Gemfile의 일부
#...............
gem "pony"
gem "bcrypt-ruby", :require => "bcrypt"
gem "nokogiri"
#..................
보석을 설치하려고 할 때 오류가 발생합니다
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 설치 ruby-dev
또는 루비 버전에 따라 작동하지 않으면 다음과 같이 실행 하십시오 .
sudo apt-get 설치 루비 1.9.1-dev
문제를 해결해야합니다.
그래도 작동이 안되는? ruby-dev를 설치 한 후 다음을 시도하십시오 :
sudo apt-get 설치 확인
jquery-rails를 설치하려고하는 것과 동일한 문제가 발생했습니다. 수정은
sudo apt-get install zlibc zlib1g zlib1g-dev
다른 버전의 루비를 설치해야한다는 것을 알았습니다. 그래서 명령을 실행
$ sudo apt-get install ruby1.9.1-dev
and then attempt to install the extension
If you run into issues where it is telling you that you don't have g++ you can run the following command to install it
$ sudo apt-get install g++
In case anyone in the future had this problem, I'm using a Mac and just had to install the Command Line Tools using 'xcode-select --install'
For WSL (Windows Subsystem for Linux) you need install build-essential
package:
sudo apt install build-essential
- Make sure
ruby-dev
is installed - Make sure
make
is installed - If you still get the error, look for suggested packages. If you are trying to install something like
gem install pg
you will also need to install the liblibpq-dev
(sudo apt-get install libpq-dev
).
It also helps to ensure libmysqlclient-dev is installed (Ubuntu 14.04)
In Mac, for me this works:
CONFIGURE_OPTS="--enable-shared" rbenv install 2.2.2
After some search for a solution, it turns out the -dev package is needed, not just ruby1.8. So if you have ruby1.9.1 doing
sudo apt-get install ruby1.9.1-dev
or to install generic ruby version, use (as per @lamplightdev comment):
sudo apt-get install ruby-dev
should fix it.
Try to locate mkmf to see if the file is actually there.
'Programing' 카테고리의 다른 글
jquery 라이브 호버 (0) | 2020.06.01 |
---|---|
S3-액세스 제어 허용 오리진 헤더 (0) | 2020.06.01 |
JavaScript에서 var가 문자열인지 어떻게 확인할 수 있습니까? (0) | 2020.06.01 |
C ++에서 임의의 영숫자 문자열을 어떻게 만듭니 까? (0) | 2020.06.01 |
Node.js에서 JSON 객체의 내용을 어떻게 기록합니까? (0) | 2020.06.01 |