Rubocop安装错误:无法构建gem

时间:2019-03-20 16:58:27

标签: ruby rubygems rubocop

当我尝试安装Rubocop时,我当前遇到此问题(我也无法安装nokigiri):

~$ sudo gem install rubocop

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

    current directory: /var/lib/gems/2.5.0/gems/jaro_winkler-1.5.2/ext/jaro_winkler
/usr/bin/ruby2.5 -r ./siteconf20190320-24856-1cn9xqz.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/jaro_winkler-1.5.2 for inspection.
Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/jaro_winkler-1.5.2/gem_make.out

我尝试了其他解决方案,但是没有一个有效。 有人知道为什么我会收到此错误吗?

Thx

1 个答案:

答案 0 :(得分:2)

您需要为ruby 2.5安装开发标头,但没有安装开发环境:

sudo apt-get install ruby2.5-dev

根据您的包装系统,也可能称为-devel