简体   繁体   English

docker 构建错误 Gem::Ext::BuildError: 错误:无法为 mimemagic-0.3.9 构建 gem 原生扩展

[英]docker build error Gem::Ext::BuildError: ERROR: Failed to build gem native extension for mimemagic-0.3.9

I have to build a docker image on my local machine to verify whether it is a building an image or not but I am facing this issue while building the docker image on a local machine.我必须在本地计算机上构建 docker 映像以验证它是否是在构建映像,但是在本地计算机上构建 docker 映像时遇到了这个问题。

 Installing mime magic 0.3.9 with native extensions
    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/bundle/gems/mimemagic-0.3.9/ext/mimemagic
/usr/local/bin/ruby -I/usr/local/lib/ruby/2.7.0/rubygems -rrubygems
/usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.1/exe/rake
RUBYARCHDIR\=/usr/local/bundle/extensions/x86_64-linux/2.7.0/mimemagic-0.3.9
RUBYLIBDIR\=/usr/local/bundle/extensions/x86_64-linux/2.7.0/mimemagic-0.3.9
rake aborted!
Could not find MIME type database in the following locations:
["/usr/local/share/mime/packages/freedesktop.org.xml",
"/opt/homebrew/share/mime/packages/freedesktop.org.xml",
"/usr/share/mime/packages/freedesktop.org.xml"]


/usr/local/bundle/gems/mimemagic-0.3.9/ext/mimemagic/Rakefile:25:in `block in
<top (required)>'
Tasks: TOP => default
(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in /usr/local/bundle/gems/mimemagic-0.3.9 for
inspection.
Results logged to
/usr/local/bundle/extensions/x86_64-linux/2.7.0/mimemagic-0.3.9/gem_make.out

An error occurred while installing mimemagic (0.3.9), and Bundler cannot
continue.
Make sure that `gem install mimemagic -v '0.3.9' --source
'https://rubygems.org/'` succeeds before bundling.
  1. Modify the Dockerfile to install the shared-mime-info package.修改Dockerfile以安装shared-mime-info package。 Eg on Debian-based images:例如在基于 Debian 的图像上:

    RUN apt-get update && apt-get install -y shared-mime-info

  2. If it still won't work, then you may need to update the mimemagic gem.如果它仍然不起作用,那么您可能需要更新mimemagic gem。 On your host, update mimemagic in the Rails app's Gemfile / Gemfile.lock .在您的主机上,更新 Rails 应用程序的Gemfile / mimemagic中的Gemfile.lock You may need to install shared-mime-info first: If the host is macOS, you may need to run brew install shared-mime-info ;您可能需要先安装shared-mime-info :如果主机是 macOS,您可能需要运行brew install shared-mime-info if the host is Ubuntu, you may need to run apt-get install shared-mime-info .如果主机是 Ubuntu,您可能需要运行apt-get install shared-mime-info Then run然后运行

    bundle update mimemagic

  3. If your Dockerfile downloads the Rails app from a repo, push your changes to that repo first.如果您的Dockerfile从存储库下载 Rails 应用程序,请先将更改推送到该存储库。 Or, for testing, modify the Dockerfile to copy in the Rails app from the host instead.或者,为了测试,修改Dockerfile以从主机复制到 Rails 应用程序中。

If you are using macOS, try the following如果您使用的是 macOS,请尝试以下操作

 brew install shared-mime-info
 bundle update mimemagic

And the try to bundle your gem file并尝试捆绑您的 gem 文件

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Rails:Gem :: Ext :: BuildError:错误:无法构建gem本机扩展 - Rails: Gem::Ext::BuildError: ERROR: Failed to build gem native extension Gem :: Ext :: BuildError:错误:无法构建gem本机扩展Mavericks - Gem::Ext::BuildError: ERROR: Failed to build gem native extension Mavericks Gem:Ext::BuildError: ERROR: Failed to build gem native extension on Mac - Gem:Ext::BuildError: ERROR: Failed to build gem native extension on Mac PG gem 不会安装在 Rails 应用程序中:Gem::Ext::BuildError: ERROR: Failed to build gem native extension - PG gem won't install in Rails app: Gem::Ext::BuildError: ERROR: Failed to build gem native extension Gem::Ext::BuildError: 错误:无法为 Puma Gem 构建 gem 本机扩展 - Gem::Ext::BuildError: ERROR: Failed to build gem native extension for Puma Gem Gem :: Ext :: BuildError:错误:无法构建gem本机扩展,安装json(1.8.1)时发生错误 - Gem::Ext::BuildError: ERROR: Failed to build gem native extension, An error occurred while installing json (1.8.1) 使用原生扩展安装 mysql2 0.4.10 Gem::Ext::BuildError: ERROR: Failed to build gem native extension - Installing mysql2 0.4.10 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension sassc 捆绑器错误:Gem::Ext::BuildError: 错误:无法构建 gem 本机扩展 - sassc bundler error: Gem::Ext::BuildError: ERROR: Failed to build gem native extension Gem :: Ext :: BuildError:错误:无法构建gem本机扩展。 GCC错误 - Gem::Ext::BuildError: ERROR: Failed to build gem native extension. GCC error Gem :: Ext :: BuildError:错误:无法在json 1.8.6和sqlite3 1.3.13上构建gem本机扩展 - Gem::Ext::BuildError: ERROR: Failed to build gem native extension on json 1.8.6 and sqlite3 1.3.13
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM