Getting 'No matching file found for src "/img/concert.jpg" in static folder "static" '
Essay97 opened this issue · 4 comments
When I run gatsby develop
I get an error that says:
"gatsby-remark-relative-images" threw an error while running the onCreateNode lifecycle:
No matching file found for src "/img/concert.jpg" in static folder "static". Please check static folder name and that file
exists at "static/img/concert.jpg". This error will probably cause a "GraphQLDocumentError" later in build. All converted field
paths MUST resolve to a matching file in the "static" folder.
The problem is that there isn't any /img/ folder in my static folder, the subfolder is called assets (previously was called img but I needed to change the name).
My config.yml :
# ...
media_folder: static/assets
public_folder: /assets
# ...
My gatsby-config.js :
plugins: [
{
resolve: `gatsby-source-filesystem`,
options: {
name: `post_images`,
path: `${__dirname}/static/assets`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `posts`,
path: `${__dirname}/src/pages`,
},
},
`gatsby-transformer-sharp`,
{
resolve: `gatsby-transformer-remark`,
options: {
plugins: [
{
resolve: `gatsby-remark-relative-images`,
options: {}
}
]
}
},
`gatsby-plugin-sharp`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
},
},
`gatsby-plugin-react-helmet`,
`gatsby-plugin-image`,
`gatsby-plugin-gatsby-cloud`,
`gatsby-plugin-netlify-cms`
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
// `gatsby-plugin-offline`,
]
How do I solve this?
i had a similar issue, the plugin fail to find an image because i have a ref in a .md file in the frontmatter see this commit, i deleted that code and the error disappeared. You should check if you have somewhere a reference to this file "/img/concert.jpg" in frontmatter of some page or other place.
Hey sorry for the late answer, it was the exact same problem