错误:无法构建本机扩展程序以构建 listen gem。

huangapple go评论68阅读模式
英文:

Error: Failed to build gem native extension building listen gem

问题

我一直在尝试运行 gem install listen,并看到下面的错误。

错误:安装 listen 时出错:

错误:无法构建 gem 的本地扩展。

当前目录:/var/lib/gems/2.5.0/gems/ffi-1.11.3/ext/ffi_c
/usr/bin/ruby2.5 -r ./siteconf20200106-9209-e0kdmx.rb extconf.rb
mkmf.rb 找不到 ruby 的头文件,路径为 /usr/lib/ruby/include/ruby.h

extconf 失败,退出码 1

英文:

I have been trying to run gem install listen and I saw this error below.

> ERROR: Error installing listen:

> ERROR: Failed to build gem native extension.

>current directory: /var/lib/gems/2.5.0/gems/ffi-1.11.3/ext/ffi_c
/usr/bin/ruby2.5 -r ./siteconf20200106-9209-e0kdmx.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

> extconf failed, exit code 1

答案1

得分: 1

"can't find header files for ruby"解释了问题。请确保安装了Ruby开发者库。根据您的操作系统和包管理器,尝试以下命令:

sudo apt-get install ruby-dev
或者

sudo yum install ruby-dev
或者

sudo apk add ruby-dev
或者

xcode-select --install

此外,请查看https://stackoverflow.com/questions/20559255/error-while-installing-json-gem-mkmf-rb-cant-find-header-files-for-ruby以及类似的建议解决方案。

英文:

"can't find header files for ruby" explains the issue best. Make sure to install Ruby developer libraries.
Depending on your OS and package manager, try

sudo apt-get install ruby-dev

or

sudo yum install ruby-dev

or

sudo apk add ruby-dev

or

xcode-select --install

Also, please check out https://stackoverflow.com/questions/20559255/error-while-installing-json-gem-mkmf-rb-cant-find-header-files-for-ruby and similar proposed solutions.

huangapple
  • 本文由 发表于 2020年1月6日 20:27:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/59612129.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定