👨⚕️
expo-doctor がネットワークエラーで失敗した場合は Fail させない
エラー内容
Expo にはプロジェクトの問題を診断するための expo-doctor というツールがあります。
このコマンドは実行時にネットワークエラーが発生してチェックに失敗することがあります。
npx expo-doctor
✖ Check Expo config (app.json/ app.config.js) schema
Unexpected error while running 'Check Expo config (app.json/ app.config.js) schema' check:
TypeError: fetch failed
SocketError: other side closed
This check requires a connection to the Expo API. Please check your network connection.
One or more checks failed, indicating possible issues with the project.
回避策
EXPO_DOCTOR_WARN_ON_NETWORK_ERRORS
環境変数を設定することで、ネットワークエラーが発生してもチェックに失敗しないようにすることができます。
EXPO_DOCTOR_WARN_ON_NETWORK_ERRORS='true' npx expo-doctor
Running 14 checks on your project...
✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check native tooling versions
✔ Check if the project meets version requirements for submission to app stores
✔ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check for app config fields that may not be synced in a non-CNG project
✔ Check for issues with Metro config
✔ Check that packages match versions required by installed Expo SDK
✔ 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: fetch failed
SocketError: other side closed
This check requires a connection to the Expo API. Please check your network connection.
EXPO_DOCTOR_WARN_ON_NETWORK_ERRORS is enabled. Ignoring network error for this check.
✔ 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
One or more checks failed due to network errors, but EXPO_DOCTOR_WARN_ON_NETWORK_ERRORS is enabled, so these errors will not fail Doctor. Run Doctor to retry these checks once the network is available.
Discussion