React Native Error: While trying to resolve module `@react-navigation/stack` from file
리액트 네이티브에 리액트 네비게이션 연동 중 에러가 발생했습니다.
error: Error: While trying to resolve module `@react-navigation/stack` from file `D:\Study\rnstudy\App.tsx`, the package `D:\Study\rnstudy\node_modules\@react-navigation\stack\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`D:\Study\rnstudy\node_modules\@react-navigation\stack\src\index.tsx`. Indeed, none of these files exist:
* D:\Study\rnstudy\node_modules\@react-navigation\stack\src\index.tsx(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
* D:\Study\rnstudy\node_modules\@react-navigation\stack\src\index.tsx\index(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
at DependencyGraph.resolveDependency (D:\Study\rnstudy\node_modules\metro\src\node-haste\DependencyGraph.js:243:17)
at Object.resolve (D:\Study\rnstudy\node_modules\metro\src\lib\transformHelpers.js:129:24)
at resolve (D:\Study\rnstudy\node_modules\metro\src\DeltaBundler\traverseDependencies.js:396:33)
at D:\Study\rnstudy\node_modules\metro\src\DeltaBundler\traverseDependencies.js:412:26
at Array.reduce (<anonymous>)
at resolveDependencies (D:\Study\rnstudy\node_modules\metro\src\DeltaBundler\traverseDependencies.js:411:33)
at processModule (D:\Study\rnstudy\node_modules\metro\src\DeltaBundler\traverseDependencies.js:140:31)
at async traverseDependenciesForSingleFile (D:\Study\rnstudy\node_modules\metro\src\DeltaBundler\traverseDependencies.js:131:3)
at async traverseDependencies (D:\Study\rnstudy\node_modules\metro\src\DeltaBundler\traverseDependencies.js:60:7)
at async DeltaCalculator._getChangedDependencies (D:\Study\rnstudy\node_modules\metro\src\DeltaBundler\DeltaCalculator.js:204:42)
* D:\Study\rnstudy\node_modules\@react-navigation\stack\src\index.tsx(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
* D:\Study\rnstudy\node_modules\@react-navigation\stack\src\index.tsx\index(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
at DependencyGraph.resolveDependency (D:\Study\rnstudy\node_modules\metro\src\node-haste\DependencyGraph.js:243:17)
at Object.resolve (D:\Study\rnstudy\node_modules\metro\src\lib\transformHelpers.js:129:24)
at resolve (D:\Study\rnstudy\node_modules\metro\src\DeltaBundler\traverseDependencies.js:396:33)
at D:\Study\rnstudy\node_modules\metro\src\DeltaBundler\traverseDependencies.js:412:26
at Array.reduce (<anonymous>)
at resolveDependencies (D:\Study\rnstudy\node_modules\metro\src\DeltaBundler\traverseDependencies.js:411:33)
at processModule (D:\Study\rnstudy\node_modules\metro\src\DeltaBundler\traverseDependencies.js:140:31)
at async traverseDependenciesForSingleFile (D:\Study\rnstudy\node_modules\metro\src\DeltaBundler\traverseDependencies.js:131:3)
at async traverseDependencies (D:\Study\rnstudy\node_modules\metro\src\DeltaBundler\traverseDependencies.js:60:7)
at async DeltaCalculator._getChangedDependencies (D:\Study\rnstudy\node_modules\metro\src\DeltaBundler\DeltaCalculator.js:204:42)
리액트 네비게이션 패키지를 설치 후 Metro를 종료 후 npm run android 등을 실행해서 프로젝트를 리빌드 후 다시 시작해줍니다.
댓글
댓글 쓰기