简体   繁体   中英

Gatsby Plugin sharp builds fine on MacOS but fails on Debian container

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

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 - 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"
  }

Error that I face:

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

  Error: Input file contains unsupported image format

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM