iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🦔

[Gatsby] How to fix "TypeError: The 'path' argument must be of type string."

に公開

Situation

  • Tried to add gatsby-plugin-manifest
 ERROR

The "path" argument must be of type string. Received an instance of Object



  TypeError: The "path" argument must be of type string. Received an instance of
   Object
    "gatsby-plugin-react-helmet",
    {
      resolved: `gatsby-plugin-manifest`,
      options: {
        name: "ここにサイト名",
        short_name: "ここに以下略",
        start_url: "/",
        background_color: "#ffffff",
        theme_color: "#477294",
        display: "standalone",
        icon:`src/images/icon.png`,
      }
    },
    "gatsby-plugin-offline",
  ],

Tried changing "" to `, but there was no change.

  `gatsby-plugin-react-helmet`,
  {
    resolved: `gatsby-plugin-manifest`,
    options: {
      name: `ここにサイト名`,
      short_name: `ここに以下略`,
      start_url: `/`,
      background_color: `#ffffff`,
      theme_color: `#477294`,
      display: `standalone`,
      icon: `src/images/icon.png`,
    }
  },
  `gatsby-plugin-offline`,
],
}

Conclusion

    {
-      resolved: `gatsby-plugin-manifest`, 
+      resolve: `gatsby-plugin-manifest`, 
      options: {
        name: `ここにサイト名`,
        short_name: `ここに以下略`,
        start_url: `/`,
        background_color: `#ffffff`,
        theme_color: `#477294`,
        display: `standalone`,
        icon: `src/images/icon.png`,
      }
    },
    `gatsby-plugin-offline`,
  ],

It turned out resolve was written as resolved! How silly!!

https://www.codegrepper.com/search.php?answer_removed=1&q=error The "path" argument must be of type string

I didn't even have react-scripts installed, so I was investigating various things, only to find out it was just a simple typo... I wasted about 30 minutes (subjectively)...

Discussion