Tag Archives: Failed to build gem native extension

Failed to build gem native extension encountered while installing sass

Error message

When executing the command: sudo gem install sass , the following error message was encountered

Building native extensions. This could take a while...
ERROR:  Error installing sass:
    ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.5.0/gems/ffi-1.11.1/ext/ffi_c
/usr/bin/ruby2.5 -r ./siteconf20190522-24821-9c6o4.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.5.0/gems/ffi-1.11.1 for inspection.
Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/ffi-1.11.1/gem_make.out

Solution

Read some online solutions, and finally through the installation of complete Ruby solution

The original command used to install ruby is: sudo apt install Ruby

Use the command sudo apt install Ruby full to install ruby, and then use the command sudo gem install sass to successfully install sass