반응형 error4 [Next] ReferenceError: window is not defined 목차 1. 원인 Next는 SSR로 서버에서 렌더링 된다. window 객체는 브라우저 환경에서만 정의되고 서버 환경에서는 window 객체가 존재하지 않기 때문에 이러한 오류가 발생함. 2. 해결 2-1. AS-IS const currentURL = window.location.href; const handleCopyClipBoard = async () => { try { alert("복사되었습니다."); } catch (error) { alert("다시 시도해주세요."); } }; return ( ); 2-2. TO-BE window 객체가 존재하는지 판단하는 코드를 추가해준다. const currentURL = typeof window !== 'undefined' ? window.location.h.. 2024. 2. 14. [error] module is not defined 목차 1. [error] module is not defined 2. 원인 eslint 설정 시 env에서 node를 설정해주지 않았기 때문이다. 3. 해결 방법 .eslintrc.js 파일에서 node를 true로 설정해준다. 2023. 6. 12. [Nodemon] 설치, 실행, 실행 에러 운영체제 : Window Nodemon 서버 코드를 수정 시 자동으로 재실행 해주는 모듈 (서버 코드 변경 시 서버 종료 후 다시 실행하는 작업을 하지않아도됨!) Nodemon 설치 (npm) ** 해당 디렉토리에 nodemon 설치 npm install nodemon ** 전체 디렉토리에서 사용하도록 설치 (-g : global) npm install -g nodemon Nodemon 실행 ** nodemon "실행할 파일" ** 예시 nodemon server.js Nodemon 실행 에러 nodemon : 이 시스템에서 스크립트를 실행할 수 없으므로 C:\Users\A\AppData\Roaming\npm\nodemon.ps1 파 일을 로드할 수 없습니다. 자세한 내용은 about_Execution_.. 2023. 4. 5. [Git] error: failed to push some refs to push error: failed to push some refs to 원인 : local과 Git hub 저장소가 일치하지 않을 때 나타남 (브렌치명이 다를 때도 동일한 에러 발생!) 해결 git pull origin main 후에 다시 git push origin main 해주기 더보기 git pull origin main // 원격 저장소의 내용을 가져와서 현재 브랜치와 병합 git add . // directory에 있는 전체 파일을 Staging area에 옮기기 git commit -m "commit message" // 커밋 메시지 기록하여 남기기 git push origin main // 원격 저장소로 push git push origin +main : 강제 push (강제로 덮어쓰기 되므.. 2023. 3. 13. 이전 1 다음 반응형