Gatsby でマークダウンの文章を手軽に装飾する(下線とかマーカーを引く、太字にするなど)
#Gatsby✎ 2021-01-30Gatsby のマークダウンで手軽に装飾する方法を記載。下線を引く、マーカーを引く、太字にする、点線を引くなどを html タグを省略して文章の一部に適用する。
npm パッケージのパッチを充てるコマンド npm audit fix
でパッケージをアップデートした後、Gatsby プロジェクトを起動しようとしたときエラーが発生したので事象と対応を記録しておきます。
npm audit fix
コマンドで登録パッケージを更新後、gatsby develop
で立ち上げようとしたとき以下のエラーが出力された。異常停止したのは yoga-layout パッケージの nbind.js の部分。activities がとれなくて例外が投げられている。
C:\nodachisoft_www\node_modules\yoga-layout-prebuilt\yoga-layout\build\Release\nbind.js:53
throw ex;
^
TypeError: Cannot read property 'activities' of undefined
at getGlobalStatus (C:\nodachisoft_www\node_modules\gatsby\node_modules\gatsby-cli\lib\reporter\redux\utils.js:20:54)
at createPendingActivity (C:\nodachisoft_www\node_modules\gatsby\node_modules\gatsby-cli\lib\reporter\redux\internal-actions.js:106:51)
at C:\nodachisoft_www\node_modules\redux\lib\redux.js:483:35
at prematureEnd (C:\nodachisoft_www\node_modules\gatsby\node_modules\gatsby-cli\lib\reporter\catch-exit-signals.js:39:38)
at Reporter.panic (C:\nodachisoft_www\node_modules\gatsby\node_modules\gatsby-cli\lib\reporter\reporter.js:72:42)
at process.<anonymous> (C:\nodachisoft_www\node_modules\gatsby\node_modules\gatsby-cli\lib\index.js:79:21)
: 中略
at processTicksAndRejections (internal/process/task_queues.js:94:32)
エラー発生したと時の環境はこんな感じ。
Gatsby のバージョンは 2.19.45 でした。
項目 | バージョン |
---|---|
OS | Windows10 Home 64bit ビルド.18363 |
node.js | 14.5.0 |
npm | 6.14.5 |
問題が起こったパッケージバージョンを抜粋
"dependencies": {
:略
"emotion": "^10.0.27",
"emotion-theming": "^10.0.27",
"gatsby": "^2.19.45", "gatsby-image": "^2.2.44",
:略
}
StackTrace のエラーログ的にも gatsby-cli 関連っぽいと想定。
GatsbyのGitHub Issue によると Gatsby-CLI と Gatsby 関連パッケージの内部の連携処理がバージョンによってはエラーを起こすとのこと。
Gatsby を "2.20.6" 以降にしてあげれば、上記エラーは修正されている。
ということで筆者の環境では package.json の gatsby を以下にして無事に動作しました。
修正後のパッケージバージョンを抜粋
"dependencies": {
:略
"emotion": "^10.0.27",
"emotion-theming": "^10.0.27",
"gatsby": "^2.20.29", "gatsby-image": "^2.2.44",
:略
}
npm install
で更新して、gatsby develop
が無事に動作。
おしまい。
コメント、ありがとうございます。
ごめんなさい。エラーでうまく送信できませんでした。ご迷惑をおかけします。しばらくおいてから再度送信を試していただくか、以下から DM などでご連絡頂ければと思います。
Twitter:@NodachiSoft_jpお名前:以下の内容でコメントを送信します。よろしければ、「送信」を押してください。修正する場合は「戻る」を押してください
お名前: