0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Tailwind/typographyを導入したらエラーで詰まった

Last updated at Posted at 2022-05-07

はじめに

現在、Next.jsとmicro CMSでブログを作成しています。
その中でリッチテキストエディタの文字部分をいい感じにスタイリングしてくれるTailwind/typographyを導入したらエラーで詰まり、エラー分をググって解決できたのですがgithubなどの英語情報しかなかったので今回記事に書き留めようと思った次第です。

Tailwind/typographyを導入する

  1. Tailwind CSS を導入する(割愛)
  2. Tailwind/typographyを導入する
npm install -D @tailwindcss/typography
               or
yarn add -D @tailwindcss/typography

これだけで良いと公式ドキュメントにも書いてますが表題のとおりエラーが発生。。。
【Tailwind CSS公式ドキュメント】

エラー文

TypeError: Cannot read properties of undefined (reading '700')

上記のようなエラー文が発生。

解決方法

以下githubのリンクにて解決。

自分で作成したNext.jsのテンプレートリポジトリの中のTailwind CSSのバージョンが古く、typographyと互換性がなかった為に発生したようです。(旧バージョンは^2.2.4)
Tailwind CSSを最新版にすれば解決しました。

最後に

今回はパッケージのバージョン管理はしっかり行うことの大切さを学び、日本語での記事などが見つからなかったことから解決に少し時間がかかってしまったので記事を書くことにしました。
同じエラーで詰まった方の助けになればと思います。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?