gatsbyjs / themes

This is a repo for Gatsby's official themes.
138 stars 77 forks source link

[gatsby-theme-i18n] Error: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined #101

Open maiertech opened 3 years ago

maiertech commented 3 years ago

I'm running into this error with gatsby-theme-i18n:

Screen Shot 2021-02-03 at 2 45 18 PM

This seems to be related to hot reloading because when I delete the cache and run it for the first time I see translated pages as expected. Therefore, I think that the theme is configured properly. Also there is no obvious reason why I would not have access to path (Node's path module) inside the gatsby-config.js.

So my question is this: is gatsby-theme-i18n under active development? Because it's not mentioned here: https://www.gatsbyjs.com/docs/how-to/adding-common-features/localization-i18n/. Or should I rather use gatsby-plugin-i18n or am I supposed to roll my own i18n?

@LekoArts Could you clarify?

asterikx commented 3 years ago

@maiertech I just run into the same issue. Are you loading MDX content through plugins other than gatsby-source-filesystem? In my case, I was also using gatsby-source-contentful, which also creates nodes with internal type Mdx for Contentful rich text fields, but does not add the field fileAbsolutePath to the node. gatsby-theme-i18n should skip Mdx nodes that have not been created by gatsby-source-filesystem, IMO.