安装compass时出现ERROR: Failed to build gem native extension...... -- mkmf (Load Error)解决办法
compass是一个css样式框架。通过ruby gem可以安装它。
[sudo] gem install compass
在安装时出现问题如下:
Fetching: sass-3.4.0.gem (100%)
Fetching: multi_json-1.10.1.gem (100%)
Fetching: compass-core-1.0.1.gem (100%)
Fetching: compass-import-once-1.0.5.gem (100%)
Fetching: chunky_png-1.3.1.gem (100%)
Fetching: rb-fsevent-0.9.4.gem (100%)
Fetching: ffi-1.9.3.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing compass:
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:4:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/ffi-1.9.3 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/ffi-1.9.3/ext/ffi_c/gem_make.out
查了一下解决办法,上面找不到的文件mkmf
是ruby1.9.1-dev包的一部分,所以把它安装上就好。
sudo apt-get install ruby1.9.1-dev
接下来立即重试安装compass,成功。