Cannot load such a file - mkmf (LoadError)

Using rbenv, installing the runnng package and getting errors when installing Json 1.8.1.

Building native extensions.  This could take a while...
ERROR:  Error installing json:
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:1:in `<main>'

Tried to install ruby-dev via apt (not sure if this will help, since ruby ​​was installed via rbenv)

what can help?

$ which gem
/home/ubuntu/.rbenv/shims/gem
$ which ruby
/home/ubuntu/.rbenv/shims/ruby
$ locate mkmf
/home/ubuntu/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/mkmf.rb
/home/ubuntu/.rbenv/versions/1.9.3-p484/share/ri/1.9.1/system/Object/mkmf-i.ri
/usr/local/rvm/gems/ruby-2.2.1/extensions/x86_64-linux/2.2.0/nokogiri-1.6.6.2/mkmf.log
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb
+4
source share
1 answer

According to your locate command, you have mkmf in rvm and in the ubuntu home directory but not on the system, and you explicitly use the system ruby ​​(not rbenv or rvm) to run extconf.rb. Either run the ruby ​​from one of the environments in which mkmf is installed, or install the ruby-dev package on the system.

+2
source

Source: https://habr.com/ru/post/1613407/


All Articles