我使用Linux Mint,我想安装sass。我已经安装了ruby by" sudo apt install ruby" ,版本2.3然后,当我想安装sass by" sudo gem install sass --no-user-install" ,我有以下错误:
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.3.0/gems/ffi-1.9.18/ext/ffi_c
/usr/bin/ruby2.3 -r ./siteconf20171114-19329-157auxp.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.3.0/gems/ffi-1.9.18 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/ffi-1.9.18/gem_make.out
答案 0 :(得分:1)
安装此软件包:
sudo apt install ruby-dev
ruby-dev package包含缺少的标头。您可以看到安装程序正在查找标题:
/usr/lib/ruby/include/ruby.h
安装此软件包将安装这些标头。这是在安装具有本机扩展的gem时为新Ruby用户提供的常见问题。您可能会发现必须安装多个软件包才能完成安装。如果您在安装此gem或其他gem时发现类似错误,请尝试搜索" gemname native extension prerequisites",例如" sass gem native extension prerequisites",以了解应安装哪些软件包在安装gem之前。
答案 1 :(得分:1)
尝试一下:
sudo apt install ruby-full rubygems autogen autoconf libtool make
sudo gem install sass
答案 2 :(得分:0)
我在Ubuntu 18.04上遇到了同样的问题,ruby-dev
本身没有帮助,安装了here的g++
和make
解决了我的问题。