【问题标题】:Gatsby 3 "Path" argument must be of type stringGatsby 3“路径”参数必须是字符串类型
【发布时间】:2021-03-18 14:32:35
【问题描述】:

我正在尝试从 Gatsby 2 升级到 3。我从 package.json 中删除了所有依赖项并安装了 Gatsby。我目前正在尝试运行gatsby develop,但出现错误:

'“路径”参数必须是字符串类型。收到一个 Object 的实例

知道如何解决这个问题吗?我不确定我需要分享什么,但这是我的gatsby-config.js

// Gatsby-config.js
module.exports = {
  siteMetadata,
  plugins: [
    {
      resolve: `gatsby-plugin-mdx`,
      options: {
        [],
        extensions: [`.mdx`, `.md`]
      }
    },
    {
      resolve: `gatsby-plugin-manifest`,
      options: {
        name: `Tyler's Blog`,
        short_name: `TylersBlog`,
        start_url: `/`,
        background_color: `#ffffff`,
        theme_color: `#663399`,
        display: `standalone`,
        icon: `content/favicon.svg`,
      },
    },
  ],
}

【问题讨论】:

    标签: reactjs gatsby


    【解决方案1】:

    删除您的package-lock.json 并由npm install 再次生成它。之后运行gatsby clean

    此外,在不知道 sitemMetaData 对象结构的情况下,很难猜测那里是否有问题,但也许您需要:

    // Gatsby-config.js
    module.exports = {
      siteMetadata.sitemMetaData,
      plugins: [
        {
          resolve: `gatsby-plugin-mdx`,
          options: {
            extensions: [`.mdx`, `.md`]
          }
        },
        {
          resolve: `gatsby-plugin-manifest`,
          options: {
            name: `Tyler's Blog`,
            short_name: `TylersBlog`,
            start_url: `/`,
            background_color: `#ffffff`,
            theme_color: `#663399`,
            display: `standalone`,
            icon: `content/favicon.svg`,
          },
        },
      ],
    }
    

    我还删除了空选项数组。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-12
      • 2020-10-21
      • 2020-08-02
      • 1970-01-01
      • 1970-01-01
      • 2019-05-13
      • 2020-09-21
      • 2020-06-20
      相关资源
      最近更新 更多