Open20
Expo SDKアップデート(47→48)の備忘録

概要
公式のExpo SDK48に記載のアップデート手順を参考に各ライブラリのバージョンアップを対応していきます。
筆者自身の脳内を整理するために記載しているものであって、もし誰か他の方も衝突することがあればと思い記載してます。

1. npm i -g eas-cli
概要
- eas-cliのバージョンを上げていく
対応内容
- Before:
- グローバルにeas-cliが入ってなかった
- After:
-
npm list -g eas-cli
でバージョン確認 - 出力結果:
eas-cli@5.2.0
-

2. npm install expo@^48.0.0
概要
- Expo SDKのライブラリのバージョンを47から48に上げる
対応内容
- Before:
"expo": "47.0.0",
- After:
"expo": "48.0.20"

3. npx expo install --fix
概要
- SDK48に紐づいた各ライブラリを整理してインストール
対応内容
- エラー発生
- Error: Error reading Expo config at ***.ts
-
expo公式のissueに近しいエラー原因を発見
- expoのバージョンが高すぎると
npx expo install --fix
を叩いた時エラーが出るとのこと -
npm install expo@48.0.6
を実行
- expoのバージョンが高すぎると

4. npm install expo@48.0.6
概要
-
npx expo install --fix
を実行するためにはexpoのバージョンをv48.0.6
にダウングレードしないといけない
対応内容
-
npm install expo@48.0.6
を実行すると下記エラーが発生
***@***-MacBook-Pro expo % npm install expo@48.0.6
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @react-navigation/material-top-tabs@6.6.3
npm ERR! Found: react-native-tab-view@2.16.0
npm ERR! node_modules/react-native-tab-view
npm ERR! react-native-tab-view@"2.16.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native-tab-view@">= 3.0.0" from @react-navigation/material-top-tabs@6.6.3
npm ERR! node_modules/@react-navigation/material-top-tabs
npm ERR! @react-navigation/material-top-tabs@"6.6.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react-native-tab-view@3.5.2
npm ERR! node_modules/react-native-tab-view
npm ERR! peer react-native-tab-view@">= 3.0.0" from @react-navigation/material-top-tabs@6.6.3
npm ERR! node_modules/@react-navigation/material-top-tabs
npm ERR! @react-navigation/material-top-tabs@"6.6.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/***/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
-
@react-navigation/material-top-tabs
とreact-native-tab-view
のバージョンを共存可能なものにアップデートする必要があるので、以下を対応
npm install @react-navigation/material-top-tabs@latest
npm install react-native-tab-view@latest
- 再度
npm install expo@48.0.6
を実行- 無事、パッチバージョンをダウングレードできたことを確認 🙌
"expo": "48.0.6",

5. npx expo install --fix(再トライ)
-
概要
- 前回までの説明として、expo公式によるとexpoバージョンが
48系の時に
npx expo install --fixを叩くためには、
48.0.6`以下にしないといけないためダウングレードした -
"expo": "48.0.6",
となったので、再度npx expo install --fix
を実行する
- 前回までの説明として、expo公式によるとexpoバージョンが
-
対応内容
-
npx expo install --fix
- 再度エラーが発生。。。
- エラー内容:
Invalid NODE_ENV or APP_ALIAS
- これはコード内で用意してる条件分岐に引っかかっただけなので、
NODE_ENV=*** APP_ALIAS=***
をコマンドの先頭に設定
- これはコード内で用意してる条件分岐に引っかかっただけなので、
-
NODE_ENV=*** APP_ALIAS=*** npx expo install --fix
(3度目の正直)- 成功 🙌
added 398 packages, removed 118 packages, changed 144 packages, and audited 2237 packages in 45s
-

6. expo-cliからの脱却
概要
-
Expo SDK48の公式によると
expo-cli
を脱却して、expo/cli
を使用するようにと記載がある
Note: if you have expo-cli installed to your project dependencies, you will need to remove it! As of SDK 46, the CLI is now part of the expo package, and having the old expo-cli package installed may cause issues such as “error: unknown option --fix’” when running npx expo install --fix.
- 私のプロジェクトでは
expo-cli
でexpo-cli publish
を行なっているので、コマンドライン上でexpo-cli
を使用しない書き方を模索する -
Expo DevelopersというExpo開発者用のDiscordにも以下の通り記載があった
-
expo publish
に不具合があるらしく、eas update
を代わりに使うよう記載がある
-
Hello,
We are trying to run our expo publish cli command to fix an issue in production in our app, and we are getting the following error:
expo publish is not supported in the local CLI, please use eas update instead
I know we need to start using eas update, since expo publish will sunset this year, but this is in progress here in our team.
Thanks for the support!
- Expo Developersで問い合わせてみると、Expo開発者から返信があった
- やはり
expo-cli publish
やexpo publish
はClassic Updates
と呼ばれているもので、Expo SDK 50に上げる前に(Expo SDK 49の内に)はEAS Update
を使用するようにとのこと
- やはり
対応方針
- Expoの開発者Kimから紹介してもらったこちらの記事の中に記載された Classic Update (expo publish) から EAS Update への移行の仕方を参考に移行を対応しようと思う
- ただし、機能で使用するライブラリではなくリリースのコマンドが変わるので、ライブラリの更新が終わった後、最後に対応しようと思う

7. npx expo-doctor
概要
-
expo: 48.0.6
にアップグレードしたことで、依存していたライブラリに不整合があるかチェック
対応方法
-
npx expo-doctor
を実行- エラーが出た箇所を1つずつ潰していく
Need to install the following packages:
expo-doctor@1.1.3
Ok to proceed? (y) y
✖ Check Expo config for common issues
✖ Check package.json for common issues
✖ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check npm/ yarn versions
✖ Check Expo config (app.json/ app.config.js) schema
Unexpected error while running 'Check Expo config (app.json/ app.config.js) schema' check:
TypeError: Cannot read properties of undefined (reading 'schema')
✔ Check that native modules use compatible support package versions for installed Expo SDK
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✖ Check that packages match versions required by installed Expo SDK
Detailed check results:
Unable to reach Expo servers. Falling back to using the cached dependency map (bundledNativeModules.json) from the package "expo" installed in your project.
Some dependencies are incompatible with the installed expo version:
expo-build-properties@0.6.0 - expected version: ~0.5.1
react-native@0.71.8 - expected version: 0.71.3
Your project may not work correctly until you install the correct versions of the packages.
Install individual packages by running npx expo install expo-build-properties@~0.5.1 react-native@0.71.3
Found outdated dependencies
Advice: Use 'npx expo install --check' to review and upgrade your dependencies.
It appears that expo.sdkVersion is defined in your app.json/ app.config.js. This can cause 'expo install' to install dependency versions for the wrong SDK. SDK version is determined by the version of the expo package installed in your project.
Advice: Remove expo.sdkVersion from your app.json/ app.config.js.
The package "@types/react-native" should not be installed directly in your project, as types are included with the "react-native" package.
The following scripts in package.json conflict with the contents of node_modules/.bin: eas, eslint, jest, patch-package.
One or more checks failed, indicating possible issues with the project.
-
npx expo install expo-build-properties@0.5.1 react-native@0.71.3
を実行-
expo-build-properties
- Before:
~0.6.0
- After:
0.5.1
- Before:
-
react-native
- Before:
0.70.5
- After:
0.71.3
- Before:
-
-
ts-jest
の依存関係でエラーが発生-
npx expo install --fix
した際にjest
のバージョンが上がっていて、jest
に依存関係を持つts-jest
のバージョンが追いついてないとのこと -
jest: "29.2.1"
は最新のバージョンに当たるから、ts-jest
のバージョンも最新まで持ってこようと思う
-
Unable to reach Expo servers. Falling back to using the cached dependency map (bundledNativeModules.json) from the package "expo" installed in your project.
› Installing 2 SDK 48.0.6 compatible native modules using npm
> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: ts-jest@26.4.1
npm ERR! Found: jest@29.7.0
npm ERR! node_modules/jest
npm ERR! jest@"^29.2.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer jest@">=26 <27" from ts-jest@26.4.1
npm ERR! node_modules/ts-jest
npm ERR! ts-jest@"26.4.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: jest@26.6.3
npm ERR! node_modules/jest
npm ERR! peer jest@">=26 <27" from ts-jest@26.4.1
npm ERR! node_modules/ts-jest
npm ERR! ts-jest@"26.4.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/***/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/***/.npm/_logs/2023-09-28T02_57_00_991Z-debug-0.log
Error: npm exited with non-zero code: 1
Error: npm exited with non-zero code: 1
at ChildProcess.completionListener (/Users/***/Develop/***/expo/node_modules/@expo/cli/node_modules/@expo/spawn-async/build/spawnAsync.js:52:23)
at Object.onceWrapper (node:events:629:26)
at ChildProcess.emit (node:events:514:28)
at maybeClose (node:internal/child_process:1091:16)
at ChildProcess._handle.onexit (node:internal/child_process:302:5)
...
at spawnAsync (/Users/***/Develop/***/expo/node_modules/@expo/cli/node_modules/@expo/spawn-async/build/spawnAsync.js:17:21)
at NpmPackageManager.runAsync (/Users/***/Develop/***/expo/node_modules/@expo/cli/node_modules/@expo/package-manager/build/node/BasePackageManager.js:38:42)
at /Users/***/Develop/***/expo/node_modules/@expo/cli/node_modules/@expo/package-manager/build/node/NpmPackageManager.js:38:20
at /Users/***/Develop/***/expo/node_modules/@expo/cli/node_modules/@expo/package-manager/build/utils/spawn.js:19:34
-
npm install ts-jest@latest
- 成功
- Before:
"ts-node": "10.8.2"
- After:
"ts-jest": "29.1.1"
- Before:
- 成功
- 先ほど失敗した
npx expo install expo-build-properties@0.5.1 react-native@0.71.3
を再度実行- 成功
- いくつかの
package-json
のライブラリのバージョンに~
が付きますが、外しておきます -
~
が付いてると、それ以降のバージョンに自動で上がることを許容してしまいます - 参考記事
- いくつかの
- 成功

npx expo-doctor
(2回目)
8. 概要
-
7. npx expo-doctor
で出てたエラーを解消したので、再度実行
対応方法
-
npx expo-doctor
- 下記エラーが出てきた
-
✔ Check that packages match versions required by installed Expo SDK
の項目が7. npx expo-doctor
では✖だったが、解消されてた
✖ Check Expo config for common issues
✖ Check package.json for common issues
✖ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check npm/ yarn versions
✖ Check Expo config (app.json/ app.config.js) schema
Unexpected error while running 'Check Expo config (app.json/ app.config.js) schema' check:
TypeError: Cannot read properties of undefined (reading 'schema')
✔ Check that native modules use compatible support package versions for installed Expo SDK
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✔ Check that packages match versions required by installed Expo SDK
Detailed check results:
It appears that expo.sdkVersion is defined in your app.json/ app.config.js. This can cause 'expo install' to install dependency versions for the wrong SDK. SDK version is determined by the version of the expo package installed in your project.
Advice: Remove expo.sdkVersion from your app.json/ app.config.js.
The package "@types/react-native" should not be installed directly in your project, as types are included with the "react-native" package.
The following scripts in package.json conflict with the contents of node_modules/.bin: eas, eslint, jest, patch-package.
One or more checks failed, indicating possible issues with the project.
- 次の3つのスレッドで、
Detailed check results:
に記載された3箇所のエラーを1つずつ潰していく
Detailed check results:
It appears that expo.sdkVersion is defined in your app.json/ app.config.js. This can cause 'expo install' to install dependency versions for the wrong SDK. SDK version is determined by the version of the expo package installed in your project.
Advice: Remove expo.sdkVersion from your app.json/ app.config.js.
The package "@types/react-native" should not be installed directly in your project, as types are included with the "react-native" package.
The following scripts in package.json conflict with the contents of node_modules/.bin: eas, eslint, jest, patch-package.
One or more checks failed, indicating possible issues with the project.
- 1つ目を見ると、expoコマンドを使わないようにと記載があるので、
eas update
に先に切り替えた方がよさそう

9. Remove expo.sdkVersion from your app.json/ app.config.js
概要
-
app.config.ts
にsdkVersion
を読み込んでる箇所があったので、無くす
対応方法
- expo SDKのバージョンを設定しているjsonファイルから
sdkVersion
を削除

10. Fix command from expo-cli publish → eas update
概要
-
npm run publish
というコマンドを叩く際、prefixにDev、Stg、Prdを添えることで、環境に応じたexpoのリリースを弊社では行なっている - その際、
npm run publish
が特定のファイルを実行していて、そのファイルでexpo-cli publish
を実行している - そこのコマンドを
eas update
を使用するようファイルを修正
対応方法
Before
const { error } = spawnSync('expo-cli', ['publish', '-c', '--release-channel', releaseChannel], {
encoding: 'utf8',
stdio: 'inherit',
});
After
const { error } = spawnSync('eas', ['update', '-channel', releaseChannel], {
encoding: 'utf8',
stdio: 'inherit',
});

11. npx expo-doctor(3回目)
概要
-
sdkVersion
を設定ファイルから消したことでどういう影響があるか確認
対応方法
-
npx expo-doctor
- いくつか ✖ だったものが ✔ になりつつ、 ✔ だったものが ✖ に変わった
✔ Check Expo config for common issues
✖ Check package.json for common issues
✖ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check npm/ yarn versions
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✖ Check that packages match versions required by installed Expo SDK
✖ Check that native modules use compatible support package versions for installed Expo SDK
Detailed check results:
Expected package @expo/config-plugins@~6.0.0
Found invalid:
@expo/config-plugins@5.0.4
@expo/config-plugins@4.1.5
(for more info, run: npm why @expo/config-plugins)
Expected package @expo/prebuild-config@~6.0.0
Found invalid:
@expo/prebuild-config@5.0.7
(for more info, run: npm why @expo/prebuild-config)
Advice: Upgrade dependencies that are using the invalid package versions.
Some dependencies are incompatible with the installed expo version:
expo-build-properties@0.5.2 - expected version: ~0.6.0
react-native@0.71.3 - expected version: 0.71.8
Your project may not work correctly until you install the correct versions of the packages.
Install individual packages by running npx expo install expo-build-properties@~0.6.0 react-native@0.71.8
Found outdated dependencies
Advice: Use 'npx expo install --check' to review and upgrade your dependencies.
The package "@types/react-native" should not be installed directly in your project, as types are included with the "react-native" package.
The following scripts in package.json conflict with the contents of node_modules/.bin: eas, eslint, jest, patch-package.
One or more checks failed, indicating possible issues with the project.
-
npx expo install expo-build-properties@0.6.0 react-native@0.71.8
を実行-
expo-build-properties
- Before:
0.5.1
- After:
0.6.0
- Before:
-
react-native
- Before:
0.71.3
- After:
0.71.8
- Before:
- 成功
-

12. npx expo-doctor(4回目)
概要
-
expo-build-properties@0.6.0
とreact-native@0.71.8
を入れたことで、ライブラリにどういう影響が出てか確認
対応方法
-
npx expo-doctor
実行-
✖ Check that packages match versions required by installed Expo SDK
が✔
に変わった
-
✔ Check Expo config for common issues
✖ Check package.json for common issues
✖ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check npm/ yarn versions
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✔ Check that packages match versions required by installed Expo SDK
✖ Check that native modules use compatible support package versions for installed Expo SDK
Detailed check results:
Expected package @expo/config-plugins@~6.0.0
Found invalid:
@expo/config-plugins@5.0.4
@expo/config-plugins@4.1.5
(for more info, run: npm why @expo/config-plugins)
Expected package @expo/prebuild-config@~6.0.0
Found invalid:
@expo/prebuild-config@5.0.7
(for more info, run: npm why @expo/prebuild-config)
Advice: Upgrade dependencies that are using the invalid package versions.
The package "@types/react-native" should not be installed directly in your project, as types are included with the "react-native" package.
The following scripts in package.json conflict with the contents of node_modules/.bin: eas, eslint, jest, patch-package.
One or more checks failed, indicating possible issues with the project.
-
@expo/config-plugins
と@expo/prebuild-config
のバージョンが生合成取れてなかったので、どう整合性取れてないのか確認する- npm why @expo/config-plugins
-
@expo/config-plugins@"~6.0.0" from @expo/prebuild-config@6.0.0
などが表示された
-
- npm why @expo/prebuild-config
-
@expo/prebuild-config@"6.0.0" from @expo/cli@0.6.2
などが表示された
-
- npm why @expo/config-plugins
- 上記から
package.json
で@expo/config-plugins@"6.0.0
と@expo/prebuild-config@"6.0.0
を指定した
"dependencies": {
"@expo/config-plugins": "6.0.0",
"@expo/prebuild-config": "6.0.0",
...
}
-
npm install
を実行- 成功

13. The package "@types/react-native" should not be installed directly in your project, as types are included with the "react-native" package.
概要
-
React-Native 0.71
から@types
を含むようになったので@types/react-native
をpackage.json
から削除する
対応方法
-
tsconfig.json
に下記設定を行う
{
"compilerOptions": {
"types": ["react-native"]
}
}
-
package.json
から@types/react-native
を削除する-
npm uninstall @types/react-native
を実行
-
-
npx expo-doctor実行
-
The package "@types/react-native" should not be installed directly in your project, as types are included with the "react-native" package.
が消えた 🙌
-

14. @expo/config-plugins と @expo/prebuild-configの他ライブラリとの整合性修正
概要
-
npm why @expo/prebuild-config
を叩いた時、@expo/prebuild-config
のバージョンが下記の通り揃ってなかった-
eas-cli@3.10.0
→@expo/prebuild-config@5.0.7
-
expo@48.0.6
→@expo/prebuild-config@6.0.0
-
expo-splash-screen@^0.18.1
→@expo/prebuild-config@6.0.1
-
対応方法
- GitHubに同じissueにぶつかってる人がいたので参考にした
- 下記の通り
package.json
上でoverrides
で上書きした
"overrides": {
"@expo/config-plugins": "~6.0.0",
"@expo/prebuild-config": "~6.0.0"
},
- 結果、まだ1件ずつエラーが残ったので、再度パッチを上げたら完全にエラーが直った
"overrides": {
"@expo/config-plugins": "~6.0.2",
"@expo/prebuild-config": "~6.0.2"
},
- 同じGitHubのissueに自分のログを残した

15. expo-modules-autolinking
概要
-
expo-modules-autolinking
のライブラリのバージョンが整合性取れない問題 - 発覚したきっかけ
npx expo-doctor
を実行
✔ Check Expo config for common issues
✖ Check package.json for common issues
✔ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check npm/ yarn versions
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check that packages match versions required by installed Expo SDK
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✖ Check that native modules use compatible support package versions for installed Expo SDK
Detailed check results:
Expected package expo-modules-autolinking@~1.1.0 || ~1.2.0
Found invalid:
expo-modules-autolinking@1.5.1
(for more info, run: npm why expo-modules-autolinking)
Advice: Upgrade dependencies that are using the invalid package versions.
対応方法
-
GitHubのissueにexpoのバージョンを
48.0.10
にすると良いと記載があったので試してみた -
expo: 48.0.20
からexpo: 48.0.10
にダウングレードnpm install expo@48.0.10
npx expo install --fix
- 変わらずエラーが出てた。。。
Detailed check results:
Expected package expo-modules-autolinking@~1.1.0 || ~1.2.0
Found invalid:
expo-modules-autolinking@1.5.1
(for more info, run: npm why expo-modules-autolinking)
Advice: Upgrade dependencies that are using the invalid package versions.
- 続いて別の解決方法も試してみた
- 解決方法には
resolutions
と記載があるが、yarn
コマンドを使用してる人はresolutions
を使うみたい - 私は
npm
コマンドのため、package.json
のoverrides
に記載
- 解決方法には
"overrides": {
"expo-modules-autolinking": "~1.2.0"
},
npx expo install --fix
npm i
npx expo-doctor
- エラーが解消された🙌

16. expo-firebase-***系 が deprecatedになった問題
概要
- ここまでで
npx expo-doctor
で表示するエラーが消えた -
Expo Go
でアプリを起動して、エラーが出てきたら解消していく
対応方法
-
npx expo
でアプリを起動 - エラーが出てきた
WARN No native ExpoFirebaseCore module found, are you sure the expo-firebase-core module is linked properly?
WARN No native ExpoFirebaseAnalytics module found, are you sure the expo-firebase-analytics's module is linked properly?
ERROR Invariant Violation: AsyncStorage has been removed from react-native core. It can now be installed and imported from '@react-native-async-storage/async-storage' instead of 'react-native'. See https://github.com/react-native-async-storage/async-storage, js engine: hermes
ERROR Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes
-
WARN
の上2つはexpo-firebase-***
系がlinkされてないと記載があるからGitHubのissueがないか見てみた - 両方Expo SDK48系から
Deprecated
になっているらしく、expo-firebase-*
ではなく、React Native Firebase
を使うようにと記載があった - 幸いGitHubにexpo-firebase-*からReact Native Firebaseへのマイグレーション方法が記載されていた
- npm remove expo-firebase-analytics
- npx expo install @react-native-firebase/app @react-native-firebase/analytics
- npx expo install expo-build-properties
- Expo configファイルで以下設定を行う(私は既に設定されていた)
- expo-firebase-coreをremoveする
-
公式によると、
expo-firebase-core
はpackage.json
からremoveするだけで済むそう(追加の対応は不要) - npm remove expo-firebase-core
-
公式によると、
{
"expo": {
"plugins": [
[
"expo-build-properties",
{
"ios": {
"useFrameworks": "static"
}
}
]
]
}
}

17. Unable to resolve "expo-firebase-analytics" from "src/app/Foundation.tsx"
概要
-
expo-firebase-analytics
を@react-native-firebase/analytics
に置き換えた際、コードも置き換えそびれてた
対応方法
- マイグレーション方法を確認
-
React Native Firebase
ではAnalytics.setDebugModeEnabled(isEnabled)
が使えなくなった- 元々expo-firebase-analyticsにあったメソッド
- React Native FirebaseのAnalyticsのメソッドを見ても、互換性がありそうなものがなかった
- 今まで通りの実装方法は難しそう
- 起動時のコマンドに引数を足すやり方もあるとは書いてある
- 使ってないなら削除しても良いかも?
- 一旦削除
-
npx expo
- 元々表示していた
Warn
は解消された
- 元々表示していた

18. Expo Go → Development buildsへの移行
概要
-
Expo SDK 48
に上げた際、expo start
が使えないと記載があったのを失念してたが、下記にも記載があるがeas コマンド
でDev環境のアプリを起動しないといけなくなった
ERROR Invariant Violation: Your JavaScript code tried to access a native module that doesn't exist.
If you're trying to use a module that is not supported in Expo Go, you need to create a development build of your app. See https://docs.expo.dev/development/introduction/ for more info., js engine: hermes
ERROR Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes
- 公式が出してる以下2つの記事にEas Updateについて
eas
に移行することになった経緯を書いている
対応方法
- Development buildsの手順に沿ってDev環境の環境設定
-
eas-cli
のバージョンアップ(記事に記載はないがiOSのビルド時に止まることが多いので最新に合わせた)-
"eas-cli": "~3.15.1"
を使用していたが、"eas-cli": "^5.4.0"にアップデート
npm install eas-cli@5.4.0
-
npx expo install --fix
(念の為、整合性が損なわないよう) -
NODE_ENV=development APP_ALIAS=default npx expo-doctor
(念の為、不具合起きてないか) - 問題ないことを確認
-
-
npx expo install expo-dev-client
- インストールできた
-
eas login
Logged in
-
eas.json
にビルドのconfigを設定
"development-default-android": {
"developmentClient": true,
"distribution": "internal",
"android": {
"buildType": "apk"
},
"env": {
"NODE_ENV": "development",
"APP_ALIAS": "default"
}
},
"development-default-ios": {
"developmentClient": true,
"distribution": "internal",
"ios": {
"simulator": true
},
"env": {
"NODE_ENV": "development",
"APP_ALIAS": "default"
}
}
- Dev環境のビルドを実行
eas build --profile development-default-ios --platform ios
- 失敗
patch-package finished with 2 warning(s), 1 error(s).
[stderr] Warning: patch-package detected a patch file version mismatch
[stderr]
[stderr] Don't worry! This is probably fine. The patch was still applied
[stderr] successfully. Here's the deets:
[stderr]
[stderr] Patch file created for
[stderr]
[stderr] @react-navigation/routers@6.1.8
[stderr]
[stderr] applied to
[stderr] [stderr] @react-navigation/routers@6.1.9
[stderr]
[stderr] At path
[stderr]
[stderr] node_modules/@react-navigation/routers
[stderr]
[stderr] This warning is just to give you a heads-up. There is a small chance of
[stderr] breakage even though the patch was applied successfully. Make sure the package
[stderr] still behaves like you expect (you wrote tests, right?) and then run
[stderr]
[stderr] patch-package @react-navigation/routers
[stderr]
[stderr] to update the version in the patch file name and make this warning go away.
[stderr]
[stderr]
[stderr] Warning: patch-package detected a patch file version mismatch
[stderr]
[stderr] Don't worry! This is probably fine. The patch was still applied
[stderr] successfully. Here's the deets:
[stderr]
[stderr] Patch file created for
[stderr]
[stderr] react-native@0.70.5
[stderr]
[stderr] applied to
[stderr]
[stderr] react-native@0.71.8
[stderr]
[stderr] At path
[stderr]
[stderr] node_modules/react-native
[stderr]
[stderr] This warning is just to give you a heads-up. There is a small chance of
[stderr] breakage even though the patch was applied successfully. Make sure the package
[stderr] still behaves like you expect (you wrote tests, right?) and then run
[stderr]
[stderr] patch-package react-native
[stderr]
[stderr] to update the version in the patch file name and make this warning go away.
[stderr]
[stderr] Error: Patch file found for package react-native which is not present at node_modules/@types/react-native
[stderr]
---
[stderr] patch-package finished with 2 warning(s), 1 error(s).
[stderr] ERROR: "patch-package" exited with 1.
[stderr] npm ERR! code 1
[stderr] npm ERR! path /Users/expo/workingdir/build/expo
[stderr] npm ERR! command failed
[stderr] npm ERR! command sh -c -- run-s prepare patch-package
[stderr]
[stderr] npm ERR! A complete log of this run can be found in:
[stderr] npm ERR! /Users/expo/.npm/_logs/2023-10-05T07_16_09_026Z-debug-0.log
npm install exited with non-zero code: 1
-
react-native
のライブラリのバージョンを上げて、かつ、types/react-native
を使わなくなった影響で、元々のバージョンに当てていたパッチが不要になった- ので、
patch-package
で当てていたパッチを外した
- ので、
- 再度Dev環境のビルドを実行
eas build --profile development-default-ios --platform ios
- expo.dev上で確認すると、ビルド成功
- expo.dev上で
tar.gz
ファイルをPCにダウンロード - ダウンロードした圧縮ファイルを解凍
- iOS Simulatorに解凍しファイル(アプリ)をドラックアンドドロップ
-
npx expo start --dev-client
を実行 -
i
を選択すると、Simulator上でiPhoneのDevアプリが起動

19. Devアプリを起動してデグレチェック
これ以降は個人的な都合で対応ができず、別の方に引き継いだので書けませんが、
以下対応が追加で必要でした。
-
AsyncStorage
でエラー- Firebaseのバージョンをv9にアップデートすると解消するはず(他チーム談)
ERROR Invariant Violation: AsyncStorage has been removed from react-native core. It can now be installed and imported from '@react-native-async-storage/async-storage' instead of 'react-native'. See https://github.com/react-native-async-storage/async-storage, js engine: hermes
- アプリを
main
を使って起動しないといけないエラー- SDK48へのアップデート対応で以下の通り書いてあるので対処方法はありそう
entryPoint has been removed from app.json / app.config.js. Use main in package.json instead.
ERROR Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes