所以我尝试在我的gatsby-config.js文件中添加gatsby-plugin-favicon

问题描述 投票:0回答:1

首先,我在gatsby-config.js文件中添加gatsby-plugin-favicon以下代码:

module.exports = {
  siteMetadata: {
    title: 'Chatbiz Blog',
  },
  plugins: [
    'gatsby-plugin-react-helmet',
    'gatsby-plugin-catch-links',
    {
      resolve: 'gatsby-source-filesystem',
      options: {
        path: `${__dirname}/src/pages`,
        name: 'pages',
      },
    },
    'gatsby-transformer-remark',
    {
      resolve: 'gatsby-plugin-favicon',
      options: {
        logo: "./src/images/icon.png",
        icons: {
          android: true,
          appleIcon: true,
          appleStartup: true,
          coast: false,
          favicons: true,
          firefox: true,
          twitter: false,
          yandex: false,
          windows: false
        }
      }
    }
  ],
}

完成添加gatsby-plugin-favicon后,出现类似这样的错误

WebpackError: ENOENT: no such file or directory, open 'C:\Users\setia\myrep  ository\GatsbyJS\gatsby_crash_course\public\.iconstats.json'

所以问题我该如何解决?

webpack gatsby
1个回答
0
投票

转到gatsby-config.js文件并删除下面提到的依赖项

icon: `src/images/gatsby-icon.png`,
© www.soinside.com 2019 - 2024. All rights reserved.