LoginSignup
1
1

More than 1 year has passed since last update.

[React Native,Expo] expo start で Cannot find module 'babel-plugin-transform-react-jsx-source と怒られる時の対処法

Last updated at Posted at 2021-07-08

エラーの概要

cloneした4,5年前のレポジトリで expo startしたら以下のメッセージが出て怒られた

Failed building JavaScript bundle.
node_modules/expo/AppEntry.js: Cannot find module 'babel-plugin-transform-react-jsx-source' from '/Users/ironsmri/Projects/sampleCodes/React_Native_Cookbook_sampleCode/Chapter02/fake-music-player'
- Did you mean "@babel/transform-react-jsx-source"?

参考までにexpoのコンソール画像
image.png

実行時の.babelrc

{
  "presets": ["babel-preset-expo"],
  "env": {
    "development": {
      "plugins": ["transform-react-jsx-source"]
    }
  }
}

解決方法

.babelrcを次のように変更した

{
  "presets": ["babel-preset-expo"]
}

どうやら変更前のbabelrcに含まれていたプラグインtransform-react-jsx-sourceはbabel-preset-expoに含まれているものらしく、明示的に記述する必要はないらしい。レポジトリが作成された当時はsubsetではなかったのかもしれない。

image.png
出典: https://forums.expo.io/t/problem-upgrading-to-sdk-31-cannot-find-babel-plugin-transform-react-jsx-source/16246/5

参考

1
1
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
1
1