gatsby: gatsby-remark-images not working (gatsby v2)
- I have read the issue at #6464 to double check the image is relative path
- I have put the .jpg file together with the .md file
Screenshot for 1 and 2
- I have double check the gatsby-config.js and here is the snippet:
module.exports = {
siteMetadata: {
title: 'Ke Han',
},
plugins: [
'gatsby-plugin-react-helmet',
'gatsby-plugin-catch-links',
'gatsby-plugin-sharp',
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/src/pages`,
name: 'pages',
},
},
{
resolve: `gatsby-transformer-remark`,
options: {
plugins: [
{
resolve: `gatsby-remark-images`,
options: {
// It's important to specify the maxWidth (in pixels) of
// the content container as this plugin uses this as the
// base for generating different widths of each image.
maxWidth: 700,
},
},
],
},
},
],
}
-
I have double check my markdown to ensure it points to the correct file:

-
The version of my gatsby-remark-images and gatsby-plugin-sharp are 1.5.67 and 1.6.48 respectively.
-
I have double checked the documentations on Gatsby V1 and Gatsby V2
After all this, the images are still not showing.
Screenshot 2: the images does not show up in the web page
Screenshot 3: gatsby-remark-images is not even doing the work
My environment:
- Mac OS 10.11.1
- Google Chrome Version 67.0.3396.99 (Official Build) (64-bit)
- Using Gatsby V2
I have read the following before I came to this point: Gatsby Starter Blog V2 Example Example on how to insert images into markdown
Everything appears normal during compiling:
Please enlighten me on this issue, thanks.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 7
- Comments: 24 (14 by maintainers)
Commits related to this issue
- build: add ignoreFileExtensions: [] to gatsby-remark-images fixes some images not being processed as of https://github.com/gatsbyjs/gatsby/issues/6698 — committed to GaiAma/gaiama.org by CanRau 5 years ago
- build: add ignoreFileExtensions: [] to gatsby-remark-images fixes some images not being processed as of https://github.com/gatsbyjs/gatsby/issues/6698 — committed to GaiAma/gaiama.org by CanRau 5 years ago
I’ve just come across this, suffering the same issue. I am running Gatsby 2.18.6 and gatsby-transformer-remark ^2.6.38. I have tried most of the things listed under this issue as well as a few other similar ones stating the same problem, but to no avail. Clearing
/node_modules
and/.cache
did nothing for me either.However, I tried downgrading gatsby-transformer-remark to 2.1.1-beta.3 as mentioned by @greglobinski. Initially this didn’t do anything, but I then found that changing file extensions from
.jpg
to.jpeg
on all affected images seemed to solve the problem - they all appear perfectly now.This is definitely odd and not a solution I would have expected to have worked but for some reason it does.
tl;dr - gatsby-transformer-remark @ 2.1.1-beta.3 and change the file extension of affected images from
.jpg
to.jpeg
.I actually stumbled into this case again, and it seems that only by applying @martin-css solution of adding
ignoreFileExtensions: []
I was able to solve thisI don’t know why, but I know that if one of these is higher than versions below, the
gatsby-remark-images
does not do the job 😃Till these versions images are generated as they should
“gatsby”: “2.0.0-beta.56”,“gatsby-transformer-remark”: “2.1.1-beta.3”,Update: Confirm @giraffesyo 's statement, gatsby on beta 59 works fine.
I can confirm that
gastby-remark-images
(2.0.1-beta.9) isn’t working for me either. I don’t have time today to dig into why butgatsby-remark-copy-linked-files
does work withignoreFileExtensions
set to[]
as a clunky work around in the meantime.This bug is not related to the
gatsby
package, as I can operate fine on beta 59. However, as soon as I upgrade fromgatsby-transformer-remark
beta 3 to beta 4 the bug is there.Came across this issue today with gatsby v4. My problem was that the
gatsby-remark-images
do not make any changes to some image files.What worked for me was to change the images (both the image and the inline markdown) with
.PNG
extension to.png
extension.I also ran into the same issue.
What is more weird is that 22 out of 69 images are processed. All of these processed images work fine (the src of parsed img in the markdown is correctly set, and the images of different versions are placed in the destination folder), whereas the rest of pictures and their respective imgs in the markdown remain unprocessed. The images that are processed seem determined and not random.
I have also found that in the GraphiQL, querying images with the following GraphQL query will yield all the 69 images, including those that are not processed.
What is more important is once the src of the pictures are queried (for example using the following query), the process of the rest of images will start, and the thumbnails will be created. The markdown will remain unchanged, though.
Currently I have to use the
gatsby-remark-copy-linked-files
to process the images.package.json
My repo: https://github.com/vicblog/VicBlog-Gatsby.
If anyone has the time to investigate further, there’s a new debugging guide that may be useful https://next.gatsbyjs.org/docs/debugging-the-build-process/
Hi @LeKoArts, I have deleted my node_modules and .cache folder and reinstall the package by running
npm install
No luck, nothing works.
My repo: https://github.com/khmy2010/kehan.com
Try deleting your node_modules and .cache folder and reinstalling the packages.
Can you provide a sample repo?
Just an update, I tried the canary tag which worked then tried the next tag again and responsive images are now being inserted into the HTML on a production build. Must have been a cache or module version issue.
@khmy2010 Worth noting that you don’t see the output in development (e.g.
gatsby develop
), only the production build (gatsby build
). However, would be nice to see something in development other than a broken image link.You need to use the v2 versions of the plugins. The migration guide explains that