본문 바로가기

코딩

[리액트 @babel/runtime 에러] Module not found: Can't resolve '/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/createForOfIteratorHelper' 해결법

리액트 @babel/runtime 에러

Module not found: Can't resolve '/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/createForOfIteratorHelper' 

 

갑자기 리액트 npm, yarn 실행이 다 안되고 위와 같은 에러만 뜨길래 당황했다.

로컬 서버는 뜨는데 그냥 하얗게 백지만 나오더라.

 

구글링해보니 다음 글을 보고 해결할 수 있었음.

 

리액트 @babel/runtime 해결법

다음과 같이 명령어를 치고 @babel/runtime을 설치한다.

yarn add @babel/runtime

 

 

설치 후 .babelrc 파일 내 다음과 같은 내용을 넣는다.

"presets": [
	["react-app", { "absoluteRuntime": false }],
]

 

그리고 다시 실행한다.

yarn start

 

오오오. 신기하게도 문제가 해결되었다! 고맙습니다!!!

 

github.com/facebook/create-react-app/issues/7183

 

Cannot find module babel-preset-react-app/node_modules/@babel/runtime/helpers/slicedToArray · Issue #7183 · facebook/create-re

Error Message on the terminal: Cannot find module '/Users/pehhuishi/code/react/practice/react-practice/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/slicedToArray Not ...

github.com