Nie można zainstalować gem - nie można zbudować macierzystego rozszerzenia gem - nie można załadować takiego pliku-mkmf (LoadError)

Ruby 1.9.3

Część Gemfile

#...............
gem "pony"
gem "bcrypt-ruby", :require => "bcrypt"
gem "nokogiri" 
#..................
Kiedy próbuję zainstalować gems, pojawia się błąd
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.

Więc robię to

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

I uzyskanie błędu, jak również.

Co mnie ominęło?
Author: MrYoshiji, 2012-12-07

8 answers

Są podobne pytania:

Zazwyczaj rozwiązaniem jest:

Sudo apt-get install ruby-dev

Lub, jeśli to nie zadziała, w zależności od wersji ruby, Uruchom coś w stylu:

Sudo apt-get install ruby1.9.1-dev

Powinien naprawić swój problem.


Nadal nie działa? Spróbuj wykonać następujące czynności po zainstalowaniu ruby-dev:

Sudo apt-get install make

 385
Author: MrYoshiji,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-09-29 13:05:18

Miałem ten sam problem przy instalacji jquery-rails. Poprawka była

sudo apt-get install zlibc zlib1g zlib1g-dev
 4
Author: B2Pi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-11-11 04:31:51

Stwierdziłem, że muszę zainstalować inną wersję Rubiego. Więc uruchamianie polecenia

$ sudo apt-get install ruby1.9.1-dev

A następnie spróbuj zainstalować rozszerzenie

Jeśli napotkasz problemy, w których mówi ci, że nie masz g++, możesz uruchomić następujące polecenie, aby go zainstalować

$ sudo apt-get install g++
 4
Author: hmjha,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-11-19 09:18:44
  1. Upewnij się, że ruby-dev jest zainstalowany
  2. Upewnij się, że make jest zainstalowany
  3. Jeśli nadal pojawi się błąd, poszukaj sugerowanych pakietów. Jeśli próbujesz zainstalować coś takiego jak gem install pg, musisz również zainstalować lib libpq-dev (sudo apt-get install libpq-dev).
 2
Author: hazmat,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-05-29 05:21:11

W przypadku, gdyby ktoś w przyszłości miał ten problem, używam komputera Mac i po prostu musiałem zainstalować narzędzia wiersza poleceń za pomocą 'Xcode-select --install'

 2
Author: NateW,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-07-11 22:32:01

Pomaga również upewnić się, że libmysqlclient-dev jest zainstalowany (Ubuntu 14.04)

 1
Author: KLaw,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-12-10 21:45:02

W Mac, dla mnie to działa:

CONFIGURE_OPTS="--enable-shared" rbenv install 2.2.2
 0
Author: rubyu2,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-08-19 08:24:51

Po pewnym poszukiwaniu rozwiązania okazuje się, że potrzebny jest pakiet-dev, a nie tylko ruby1.8. Więc jeśli masz ruby1.9. 1 robi

sudo apt-get install ruby1.9.1-dev

Lub aby zainstalować generyczną wersję ruby, użyj (zgodnie z komentarzem @ lamplightdev):

sudo apt-get install ruby-dev

Powinno to naprawić.

Spróbuj zlokalizować mkmf, aby sprawdzić, czy plik rzeczywiście tam jest.

 0
Author: Rahi.Shah,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-08-01 10:20:49