LoginSignup
11
3

More than 3 years have passed since last update.

【Gatsby.js 】チュートリアルでError: Cannot find module 'react'

Last updated at Posted at 2019-11-24

公式チュートリアルなのに

gatsby-starter-hello-worldのスターターを使用してGatsby.jsを動かしていくのだけども、そのなかのtypographyプラグインを使う箇所で不具合が発生してうまく進められなくなる。

Error: Cannot find module 'react' :rotating_light: 発生

チュートリアルのchapter3でプラグインをnpm installしたあとに gatsby developすると発生する不具合。

解決法

学習が進められるようになるよ :nerd: :nerd:

npmを使わない、yarnを使う。

チュートリアルに合わせていうならば
yarn add gatsby-plugin-typography react-typography typography typography-theme-fairy-gatesをつかう。

原因

npm :package: 側の問題。
結構前からこのissueで論議されているけれどまだnpm側が治ってないみたいです。解決策のみ抜粋しましたので、詳しくは前記issueをご覧ください。

なのでGatsbyでのパッケージインストールはyarnを使用するのが良さそうです :nerd:

以上です:nerd: ありがとうございます.

11
3
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
11
3