英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论