gem install sass – ERROR: Failed to build gem native extension的解决方法

作者

在安装sass的时候遇到了,遇到了错误提示 ERROR: Failed to build gem native extension , 原因是没有安装 ruby-devel

如果是centos 直接

yum install ruby-devel

报错的详细信息

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

    current directory: /usr/local/share/gems/gems/ffi-1.13.1/ext/ffi_c
/usr/bin/ruby -r ./siteconf20201014-54701-lligkf.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /usr/local/share/gems/gems/ffi-1.13.1 for inspection.
Results logged to /usr/local/lib64/gems/ruby/ffi-1.13.1/gem_make.out