LoginSignup
1
2

More than 5 years have passed since last update.

react-native 0.57.2の導入エラー

Posted at

最新のreact nativeでビルドエラーが発生したので備忘録兼ねてメモ。
いつもreact nativeの導入で苦労する気がする。

react native バージョン

  • react-native 0.57.2
  • Win 10

実行時にエラー

>react-native run-android
error: bundling failed: Error: Unable to resolve module `./../../react-transform-hmr/lib/index.js`

詳しいことはわからないけど、run-androidのバグらしい。
https://github.com/facebook/react-native/issues/21490

回避策1

回避策は、ターミナル2つ立ち上げて、development serverの起動とアプリの起動を別で行うこと。

1st-tab
react-native start --reset-cache
2nd-tab
react-native run-android

回避策2

react-nativeを0.57.1に落として、babelを入れ直す。

> rm -rf ./node_modules/
> vi package.json
   //react nativeのバージョンを0.57.1に
> npm install @babel/runtime
> npm install

回避策1を実施した場合、追加しているパッケージによってはビルド時にエラーが発生する。これは親子関係にない2プロセスで実行フォルダを共有してしまうため。少なくともreact-native-google-signin使用時にはこけてしまう。

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