본문 바로가기

에러/react8

[React] EPERM: operation not permitted 에러 리액트 개발 중 모듈을 설치하기 위해 yarn add 명령을 사용하다 발생한 에러이다. 찾아보니 리눅스에서는 발생하지 않으나 윈도우에서 종종 발생하는 에러라고 한다. 에러 요인은 모르겠으나, 해결은 했으니... 리액트가 실행중이라면, 서버를 중지하고 다시 설치를 시도해보기 바란다. 간단하게 해결되었다! 2021. 6. 26.
[React] Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops. 에러 리액트 작업 중 input의 onChange 이벤트를 처리하는 과정에서 매게변수를 전달하려다 에러가 발생하였다. 해당 에러는 onChange, onClick 등에서 발생하는 듯 하다. 와 같이 this.handleToggleLoop()로 작성하게 되면 함수를 반복해서 호출하게 된다. 또는 this.handleToggleLoop()} /> 형태로 사용하면 원하는대로 동작하게 된다. 2021. 5. 12.
[React] Uncaught (in promise) TypeError: Cannot read property 'push' of undefined 리액트 작업 중 로그인 후 페이지 대시보드로 넘기는 기능을 개발하는 중에 발생한 에러이다. 간단하게 props.history.push('/') 만으로 페이지가 넘어갈 줄 알았는데, 전혀 기능을 하지 않았다. 이를 해결하기 위해서는 react-router-dom 의 withRouter를 import하고, export 시 withRouter로 감싸주어야 한다. import { withRouter } from 'react-router-dom' ... export default withRouter(SamplePage) 2021. 5. 3.
[React] TypeError Cannot read property 'setState' of undefined 에러 리액트 작업 중 this.setState 함수로 상태를 변경하고자 할 때 발생하였다. 발생한 원인은 호출하는 함수를 bind 하지 않았기 때문이었다. 해결 방법은 두 가지이다. 1. Constructor에 함수 바인딩 this.onChange = this.onChange.bind(this) 2. Arrow function으로 구현 onChange = () => {} 2021. 5. 3.
[NodeJS] cannot set headers after they are sent to the client 에러 NodeJS 실행 도중 에러가 발생하였다. cannot set headers after they are sent to the client 라는 문구를 띄었는데, 확인해 보니 콜백 함수를 두 번 호출하여 발생한 에러였다. 나의 경우 다음 코드에서 에러가 발생하였고, res 하나를 지우니 해결되었다. 2021. 3. 10.
[React] ENOSPC: System limit for number of file watchers reached 에러 에러 내용: ENOSPC: System limit for number of file watchers reached file watcher가 limit 이라 발생한 에러로 echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p 명령으로 해결할 수 있을 것이다 2021. 1. 31.