Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazonアプリストア
Ring
AWS
ドキュメント
Support
Contact Us
My Cases
開発
設計と開発
公開
リファレンス
サポート

React Native 0.83への移行に関する問題のトラブルシューティング

React Native 0.83への移行に関する問題のトラブルシューティング

このドキュメントでは、アプリをReact Native 0.83に移行するときに発生する一般的なエラーの解決策について説明します。

npmのエラー

ERESOLVE - ピア依存関係の解決が失敗する

エラー: ERESOLVE unable to resolve dependency tree

修正:

  1. クリーンインストールを行います。
    rm -rf node_modules package-lock.json
    npm install
    
  2. それでもエラーが発生する場合は、エラー出力(「Found: X」と「Could not resolve: Y」)から競合を特定します。
  3. 依存関係のすべてのバージョンが、ターゲットのRN 0.83の要件と一致していることを確認します。
  4. --legacy-peer-depsは使用しないでください。使用すると、ランタイムエラーを引き起こす競合が隠されてしまいます。

ピアのreactバージョンが競合する(0.72がキャッシュされている)

エラー:peer react@... from react-native@0.72またはConflicting peer dependency: react@19

原因: node_modulesにキャッシュされたreact-native@0.72.0がReact 19と競合しています。

修正:

rm -rf node_modules package-lock.json

package.jsonに、"react": "19.2.0""react-native": "0.83.0""@types/react": "^19.2.0"が含まれていることを確認します。

@types/reactのバージョンが一致しない

エラー: Found: @types/react@18 / peerOptional @types/react@^19

修正: devDependenciesを更新します。

"@types/react": "^19.2.0",
"@types/react-test-renderer": "^19.1.0"

ts-jestのピア依存関係が競合する

エラー:peer jest@^28.0.0 from ts-jest

修正: ts-jestをjest v29に一致するように更新します。

"ts-jest": "^29.1.0"

TypeScriptのエラー

extendsに指定したtsconfig.jsonが見つからない

エラー: TS6053: File '@react-native/typescript-config/tsconfig.json' not found

修正:

"extends": "@react-native/typescript-config"

/tsconfig.jsonというサフィックスを削除します)

allowImportingTsExtensionsまたはcustomConditions

エラー: TS5096またはTS5098

修正: tsconfig.jsonにオーバーライドを追加します。

"compilerOptions": {
  "moduleResolution": "bundler",
  "allowImportingTsExtensions": false
}

isolatedModulesで型の再エクスポートがエラーになる

エラー: TS1205: Re-exporting a type when 'isolatedModules' is enabled

修正:

export type { Cookie } from './types/CookieManagerTypes';

CMakeとネイティブビルドに関するエラー

keplerscriptターゲットが見つからない

エラー: Target links to keplerscript-2 but the target was not found

修正: cxx/CMakeLists.txtで次の変更を行います。

# すべての参照を次のように変更します。
keplerui::keplerscript-2 → keplerui::keplerscript-4

C++20の機能がサポートされない

エラー: C++20 features not supported

修正: CMake 3.22以降と、C++20互換コンパイラ(GCC 10以降、Clang 12以降)を使用します。

Metroバンドラーのエラー

Cannot find module '@react-native/babel-preset'

修正:

rm -rf node_modules
npm install
npm start -- --reset-cache

Unable to resolve module

修正:

rm -rf node_modules/.cache
npm start -- --reset-cache

Jestとテストに関するエラー

SyntaxError: Cannot use import statement outside a module(プラットフォームパッケージ)

原因:@amazon-devices/react-native-kepler@4.0.0では、jestのセットアップでESモジュールが使用されています。

修正: jest.configで、transformIgnorePatternsに次のパターンを追加します。

"node_modules/(?!((jest-)?react-native|@react-native(-community)?|@amazon-devices/react-native-kepler)|react-native-safe-area-context)"

Cannot read properties of undefined(Dimensions/PixelRatio/StyleSheet)

原因: React 19でモックの動作が変更されました。これらのAPIにはモックが用意されていません。

修正: jest.setup.jsにモックを追加します(手順7.2を参照)。

Can't access .root on unmounted test renderer

原因: @testing-library/react-nativerender()ReactTestRenderer.act()でラップされています。

修正: act()によるラッピングを削除します。これはテストライブラリによって内部で処理されます(手順7.4を参照)。

NativeAnimatedModuleのメソッドスタブがない

エラー: Cannot read properties of undefined (reading 'apply')NativeAnimatedHelper.js内)

原因: RN 0.83のアニメーションシステムでは、NativeAnimatedModuleの特定の23個のメソッドが呼び出されます。

修正: jest.setup.jsに完全なモックを追加します(手順7.2を参照)。

エラー: You are trying to import a file after the Jest environment has been torn down

修正:

beforeEach(() => jest.useFakeTimers());
afterEach(() => {
  jest.runOnlyPendingTimers();
  jest.useRealTimers();
});

keplerscript-native-ui-componentsにreact-nativeが入れ子になっている

エラー: keplerscript-native-ui-components/node_modules/react-nativeからのフロー/ESM解析エラー

原因:kepler-ui-components@2.xにはreact-nativeの独自のコピーがバンドルされています。

修正: @amazon-devices/kepler-ui-components@3.0.0にアップデートします。

実行時のエラー

Failed to load runtime module: IKeplerScript_2_0

原因:manifest.tomlで、以前のKepler 2.xランタイムが参照されています。

修正: manifest.tomlのruntime-moduleのパスを更新します(手順4を参照)。

Cannot find module '@amazon-devices/keplerscript-commonmodules'

修正: devDependenciesに以下を追加します。

"@amazon-devices/keplerscript-commonmodules": "^1.0.0"

Unrecognized command build-kepler

原因:@react-native-community/cliが削除されています。

修正: devDependenciesに以下を追加します。

"@react-native-community/cli": "11.3.2"

ReferenceError: useState is not defined

修正: 明示的なインポートを追加します。

import React, { useState, useEffect, useCallback } from 'react';

Last updated: 2026年7月9日