No se puede instalar gem-No se pudo construir la extensión nativa de gem-no se puede cargar dicho archivo-mkmf (LoadError)
Ruby 1.9.3
La parte de Gemfile
#...............
gem "pony"
gem "bcrypt-ruby", :require => "bcrypt"
gem "nokogiri"
#..................
Cuando estoy tratando de instalar gemas, me sale un error
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.
Entonces estoy haciendo esto
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
Y obtener un error también.
¿Qué me perdí?
8 answers
Hay preguntas similares:
- `require': no hay tal archivo para cargar mk mkmf (LoadError)
- Error al construir la extensión nativa de gem (mkmf (LoadError)) - Ubuntu 12.04
Normalmente, la solución es:
Sudo apt-get install ruby-dev
O, si eso no funciona, dependiendo de tu versión de ruby, ejecuta algo como:
Sudo apt-get install ruby1. 9. 1-dev
Debería arreglar su problema.
¿Todavía no funciona? Pruebe lo siguiente después de instalar ruby-dev:
Sudo apt-get install make
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-09-29 13:05:18
Tuve el mismo problema al intentar instalar jquery-rails. La solución fue
sudo apt-get install zlibc zlib1g zlib1g-dev
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-11-11 04:31:51
Encontré que necesitaba instalar otra versión de ruby. Así que ejecutando el comando
$ sudo apt-get install ruby1.9.1-dev
Y luego intentar instalar la extensión
Si tiene problemas en los que le dice que no tiene g++, puede ejecutar el siguiente comando para instalarlo
$ sudo apt-get install g++
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-11-19 09:18:44
- asegúrese de que
ruby-dev
está instalado - asegúrese de que
make
está instalado - Si todavía obtiene el error, busque paquetes sugeridos. Si está intentando instalar algo como
gem install pg
también necesitará instalar la liblibpq-dev
(sudo apt-get install libpq-dev
).
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-05-29 05:21:11
En caso de que alguien en el futuro tuviera este problema, estoy usando un Mac y solo tuve que instalar las Herramientas de línea de comandos usando 'xcode-select install install'
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-07-11 22:32:01
También ayuda a asegurar que libmysqlclient - dev esté instalado (Ubuntu 14.04)
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-12-10 21:45:02
En Mac, para mí esto funciona:
CONFIGURE_OPTS="--enable-shared" rbenv install 2.2.2
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-08-19 08:24:51
Después de buscar una solución, resulta que se necesita el paquete-dev, no solo ruby1.8. Así que si usted tiene ruby1.9. 1 haciendo
sudo apt-get install ruby1.9.1-dev
O para instalar la versión genérica de ruby, use (según el comentario de @lamplightdev):
sudo apt-get install ruby-dev
Debería arreglarlo.
Intente localizar mkmf para ver si el archivo está realmente allí.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-08-01 10:20:49