此 ubuntu 版本带来了ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
。所以我所做的安装都是正常过程,但是gem install compass
此安装引发此错误:
Building native extensions. This could take a while...
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/ffi-1.9.14/ext/ffi_c
/usr/bin/ruby2.3 -r ./siteconf20160907-12074-v2oz2d.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.14 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/ffi-1.9.14/gem_make.out
我尝试ruby-dev
使用 root 身份执行的命令进行安装apt get install ruby-dev
,但由于某种原因,该命令在 ubuntu 上不可用,并抛出了此错误:
Package ruby-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'ruby-dev' has no installation candidate
答案1
compass
由于缺少 ruby-dev 安装,安装失败。
ruby-dev 包含在 Ubuntu 的存储库中。您必须更新存储库才能获得完整可用的软件包和依赖项。
执行以下命令来做到这一点:
$ sudo apt update
$ sudo apt upgrade
$ sudo apt full-upgrade
$ sudo apt install ruby-dev