在Gatsby主题中,需要一个可以作为名称起始的字符,例如字母、`$` 或 `_`。

huangapple go评论102阅读模式
英文:

expected a character that can start a name, such as a letter, `$`, or `_` in Gatsby theme

问题

I have used Smooth docs Gatsby theme and while trying to run project "Gatsby Develop" terminal shows this errors ..

我使用了Smooth docs Gatsby主题,尝试运行项目时,终端显示以下错误..

I'm reading mdx files in my project and that mdx files has js and other languages codes too for documentation perpose.

我正在阅读我的项目中的mdx文件,这些mdx文件还包含用于文档目的的js和其他语言的代码。

here is dependencies which i have installed in package.json

这是我在package.json中安装的依赖项。

and if required i can share code of gatsby-config.js and gatsby-node.js

如果需要的话,我可以分享gatsby-config.js和gatsby-node.js的代码。

英文:

I have used Smooth docs Gatsby theme and while trying to run project "Gatsby Develop" terminal shows this errors ..

在Gatsby主题中,需要一个可以作为名称起始的字符,例如字母、`$` 或 `_`。

I'm reading mdx files in my project and that mdx files has js and other languages codes too for documentation perpose.

here is dependencies which i have installed in package.json

在Gatsby主题中,需要一个可以作为名称起始的字符,例如字母、`$` 或 `_`。

and if required i can share code of gatsby-config.js and gatsby-node.js

答案1

得分: 1

I got the exact same error when having an unescaped <! in my mdx files.
当我的mdx文件中出现未转义的<!时,我也遇到了完全相同的错误。

Most likely some html comment (<!-- some comment -->).
很可能是一些HTML注释(<!-- some comment -->)。

The error message hints you how to create comments
错误消息提示你如何创建注释

(note: to create a comment in MDX, use {/* text */})
(注意:在MDX中创建注释,请使用{/* text */}

It's also described here.
这也在这里有描述。

To help you spot such things, you could look for mdx extensions/plugins for your IDE, e.g. this mdx extension for VSCode or follow the advice from the link above and install eslint-mdx to validate your mdx files.
为了帮助你发现这类问题,你可以在你的IDE中寻找mdx扩展/插件,例如,对于VSCode,可以使用这个mdx扩展,或者按照上面的链接建议安装eslint-mdx来验证你的mdx文件。

With eslint-mdx you will also see exactly the file and code line where your mdx files are broken. Somehow this is not logged in the error message when you try to run the project.
使用eslint-mdx,你还可以准确地看到你的mdx文件中出错的文件和代码行。不知何故,当你尝试运行项目时,这些信息没有记录在错误消息中。

英文:

I got the exact same error when having an unescaped <! in my mdx files.
Most likely some html comment (<!-- some comment -->).

The error message hints you how to create comments

> (note: to create a comment in MDX, use {/* text */})

It's also described here.

To help you spot such things, you could look for mdx extensions/plugins for your IDE, e.g. this mdx extension for VSCode or follow the advice from the link above and install eslint-mdx to validate your mdx files.

With eslint-mdx you will also see exactly the file and code line where your mdx files are broken. Somehow this is not logged in the error message when you try to run the project.

huangapple
  • 本文由 发表于 2023年4月13日 15:35:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/76002795.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定