2017-05-02 5 views
0

React Native를 사용하여 앱을 만들고 있는데이 오류가 있습니다.UnableToResolveError : 모듈`./node_modules/react-native/packager/src/components`을 확인할 수 없습니다.

캐시를 지우고 패키지를 다시 설치하려고했지만 계속 문제가 발생했습니다.

이것은 터미널의 오류 메시지입니다.

UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): UnableToResolveError: Unable to resolve module ./node_modules/react-native/packager/src/components from /Users/andy/Downloads/testapp/index.ios.js : Directory /Users/andy/Downloads/testapp/node_modules/react-native/packager/src/components doesn't exist

그리고 아래는 iOS 시뮬레이터의 스크린 샷입니다. enter image description here

아무도 도와 줄 수 있습니까?

+0

합니까이 경로 "/ 사용자/앤디/다운로드/testapp를/node_modules/반응 네이티브/포장기/SRC/구성 요소가"시스템에 존재? – atitpatel

+0

찾을 수 없습니다. 어떻게 추가 할 수 있습니까? –

+0

존재하지 않는 경우 추가 할 필요가 없습니다. 대신 상대 경로를 변경하십시오. index.ios.js에서 항목을 가져 오시겠습니까? – atitpatel

답변

1

babel-plugin-module-resolver를 종속성으로 사용하고 있습니까? src라는 하위 디렉토리에 components라는 하위 디렉토리가 있습니까? 그렇다면 내가 최근에 실행 한 것과 비슷한 문제가 발생할 수 있다고 생각합니다. 응용 프로그램은 잘못된 경로 (node_modules 아래)를 조사하는 동안 구성 요소의 src/구성 요소를 실제로 조사해야합니다.

npm start - --reset-cache를 실행하여 일시적으로 문제를 해결 한 후 시뮬레이터를 2 ~ 3 번 새로 고침 할 수있었습니다. 이제는 bable-plugin-module- 해결 자다. 여기

는 관련 문제 : https://github.com/tleunen/babel-plugin-module-resolver/issues/138

0

"루트"파일을 가져 오는 방법에 문제가있는 것 같습니다. 현재 계층 구조를 확인하고 상대 경로를 확인하여 루트 파일을 가져옵니다.