バグを説明する
ギャツビービルドが壊れています。 https://www.docz.site/docs/gatsby-theme#how-to-useの指示に従いました
バグが何であるかについての明確で簡潔な説明。
gatsby develop
昼食するとき。
再現するには
➜ hello-gatsby git:(feature/add-documentation) gatsby develop
Configuring yargs through package.json is deprecated and will be removed in the
success open and validate gatsby-configs - 2.034 s
success load plugins - 0.970 s
Configuring yargs through package.json is deprecated and will be removed in the
success onPreInit - 0.312 s
success initialize cache - 0.006 s
success copy gatsby files - 0.066 s
success onPreBootstrap - 0.009 s
Configuring yargs through package.json is deprecated and will be removed in the
success source and transform nodes - 0.532 s
success building schema - 0.287 s
Configuring yargs through package.json is deprecated and will be removed in the
success createPages - 0.309 s
success createPagesStatefully - 0.036 s
success onPreExtractQueries - 0.002 s
success update schema - 0.041 s
ERROR
There was a problem parsing "/Users/laurentsutterlity/Works/hello-gatsby/node_modules/gatsby-theme-docz/templates/Layout.tpl.js"; any GraphQL fragments or queries in this file were not processed.
This may indicate a syntax error in the code, or it may be a file type that Gatsby does not know how to parse.
ERROR #85901 GRAPHQL
There was an error in your GraphQL query:
Error: RelayParser: Encountered duplicate defintitions for one or more documents: each document must have a unique name. Duplicated documents:
- DefaultSEOQuery
success extract queries from components - 8.357 s
success write out requires - 0.008 s
success write out redirect data - 0.002 s
success Build manifest and related icons - 0.137 s
success onPostBootstrap - 0.144 s
⠀
info bootstrap finished - 17.704 s
⠀
success run static queries - 0.002 s
success run page queries - 0.026 s — 7/7 292.91 queries/second
DONE Compiled successfully in 6477ms 09:12:11
⠀
You can now view hello-gatsby in the browser.
⠀
http://localhost:8000/
⠀
View GraphiQL, an in-browser IDE, to explore your site's data and schema
⠀
http://localhost:8000/___graphql
⠀
Note that the development build is not optimized.
To create a production build, use npm run build
環境
これはギャツビーの新しいバージョンに関連するバグです。彼らはこれを修正するために働いていると思います。
cc @pieh
ここで同様の問題
同じ問題にぶつかって、まだ機能する可能性のある以前のバージョンのギャツビーがあるかどうか、または古いバージョンを検討することさえ依存関係の混乱があるかどうかを知っていますか?
Doczテーマをインストールした後、同様の問題が発生します。
編集:実際、私はまったく同じ問題を抱えています。
回避策はありますか?
Docz Themeをインストールした後、ここでも同じです。
編集:この問題に関するニュースはありますか?
v2に移行しようとした後、この問題も発生しています。 そして、ギャツビーに関連しているのに、なぜv1タグがあるのですか?
v2.0.0-rc.31
この問題に直面します😬
誰かがv2を使用している場合は、gatsbyが最新であり、問題がないことを確認してください。何らかの理由でv1に固執している人(私のように)は、doczgatsbyのファイルを変更することでローカルで問題を解決できます。テーマnode_modules
の主な欠点は、依存関係を追加または更新するたびに修正が上書きされることですが、ビルドの一部としてファイルを置き換えるだけで、完全に自動化された状態を維持できます。
主な問題は、クエリをエクスポートするファイルnode_modules/gatsby-theme-docs/templates/Seo.js.tpl
であり、別のファイルを生成するためのテンプレートであることが意図されているため、gatsbyによって処理されているため、クエリ名がスキーマで重複してしまいます。つまり、エラーが発生します。 。 したがって、これを修正するには、クエリから名前を削除する必要があります。クエリ名は変数を使用する場合にgraphqlでのみ必要であり、このクエリには名前は必要ないため、そのファイルで変更するだけです。
query DefaultSeoQuery {
に
query {
解決策をありがとう@jstacoder👍 !
@jstacoderのソリューションを使用して、ビルドステップの一部としてnode_modules
を一貫して変更する場合は、必ずpatch-package
を確認してください。
この問題は、最近のアクティビティがないため、自動的に古いものとしてマークされています。 それ以上のアクティビティが発生しない場合は閉じられます。 貢献していただきありがとうございます。
最も参考になるコメント
誰かがv2を使用している場合は、gatsbyが最新であり、問題がないことを確認してください。何らかの理由でv1に固執している人(私のように)は、doczgatsbyのファイルを変更することでローカルで問題を解決できます。テーマ
node_modules
の主な欠点は、依存関係を追加または更新するたびに修正が上書きされることですが、ビルドの一部としてファイルを置き換えるだけで、完全に自動化された状態を維持できます。主な問題は、クエリをエクスポートするファイル
node_modules/gatsby-theme-docs/templates/Seo.js.tpl
であり、別のファイルを生成するためのテンプレートであることが意図されているため、gatsbyによって処理されているため、クエリ名がスキーマで重複してしまいます。つまり、エラーが発生します。 。 したがって、これを修正するには、クエリから名前を削除する必要があります。クエリ名は変数を使用する場合にgraphqlでのみ必要であり、このクエリには名前は必要ないため、そのファイルで変更するだけです。に