Gatsby Plugin Sharp在MacOS上构建良好,但在Debian容器上失败 [英] Gatsby Plugin sharp builds fine on MacOS but fails on Debian container

查看:69
本文介绍了Gatsby Plugin Sharp在MacOS上构建良好,但在Debian容器上失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Gatsby Plugin Sharp与其他插件一起用于备注图像.下面提供了json包.

I am using Gatsby Plugin sharp with other plugins for remark images. Package json provided below.

奇怪的是,该构建在MacOS上运行正常,但在Debian docker容器内失败,同时尝试获取PNG图像的元数据.gatsby-plugin-sharp会遇到此错误

Strangely the build goes through fine on MacOS but fails inside the Debian docker container while try to fetch metadata for a PNG image. This error is faced by gatsby-plugin-sharp

package.json-仅包含依赖项

package.json - only dependencies included

"dependencies": {
    "@buzz/as-components": "^1.0.3",
    "@dx/continuum-footer": "^1.5.1",
    "@marcom/ac-sasskit": "^7.3.0",
    "gatsby": "^2.26.1",
    "gatsby-plugin-emotion": "^5.2.0",
    "gatsby-plugin-flexsearch": "^1.0.3",
    "gatsby-plugin-manifest": "^2.6.1",
    "gatsby-plugin-offline": "^3.4.0",
    "gatsby-plugin-react-helmet": "^3.4.0",
    "gatsby-plugin-sass": "^3.0.0",
    "gatsby-plugin-sharp": "^2.14.1",
    "gatsby-remark-autolink-headers": "^2.10.0",
    "gatsby-remark-code-buttons": "^2.0.4",
    "gatsby-remark-images-anywhere": "^1.3.0",
    "gatsby-remark-prismjs": "^3.13.0",
    "gatsby-source-filesystem": "^2.5.0",
    "gatsby-transformer-remark": "^2.16.0",
    "gatsby-transformer-sharp": "^2.12.0",
    "prismjs": "^1.23.0",
    "prop-types": "^15.7.2",
    "react": "^16.13.1",
    "react-dom": "^16.12.0",
    "react-helmet": "^6.1.0",
    "react-multilevel-sidebar": "^1.0.4",
    "remark-grid-tables": "^2.1.1",
    "sass": "^1.32.4"
  },
  "engines": {
    "node": ">=15.0.0 <=15.8.0"
  },
  "devDependencies": {
    "node-sass": "^5.0.0",
    "prettier": "2.2.1"
  }

我遇到的错误:

/app/src/blog/2019-02-19-gridsome-05/plugins.png
 

  Error: Input file contains unsupported image format

有关该错误的详细信息不多-任何帮助将不胜感激.我觉得这可能是C库的问题,因为Gatsby插件是动态构建并利用C/CPP库的.

There isn't much details available around the error - Any help would be appreciated. I feel like this could be a C library issue as Gatsby Plugin builds on the fly and leverages C/CPP libraries.

推荐答案

最终解决了这一问题-将问题的原因留在这里,以便对他人有所帮助-我正在使用NodeJS-15.8.0-slim基本图像.Gatsby Plugin Sharp依赖于幕后的C库和二进制文件,而Slim基本映像中并未真正包含这些库和二进制文件.我使用了15.8.0克星图像,效果很好.

Ended up solving this - Leaving the cause of issue here so that it can help others - I was using a NodeJS - 15.8.0-slim base image. Gatsby Plugin Sharp is dependent on C libraries and binaries behind the scenes which were not really included in the Slim base image. I used 15.8.0-buster image and it worked all good.

该日志极具误导性,最终浪费了我很多时间.希望这样可以节省其他所有人的时间.

The log was extremely misleading and ended up wasting a lot of my time. Hope this saves the time of anyone else who ends up with this.

这篇关于Gatsby Plugin Sharp在MacOS上构建良好,但在Debian容器上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆