본문 바로가기

전체보기106

[EC2] sudo node 명령어 에러 (The Node-API version of this Node instance is 1) AWS EC2에서 node index.js 명령어는 문제 없이 실행이 된다. 그러나 sudo node index.js는 실행이 되지 않는다. Error: The Node-API version of this Node instance is 1. This module supports Node-API version(s) 3. This Node instance cannot run this module. 이는 sudo 경로의 문제로 발생한 에러이다. sudo 경로를 바꿔서 해결할 수 있다. 그러나 which 명령어를 사용하여 간단한 해결이 가능하다. sudo `which node` index.js 참고 링크 : https://stackoverflow.com/questions/4976658/on-ec2-sudo-no.. 2022. 9. 30.
[AWS] HTTPS 배포 관련 URL 생성 및 공인인증서 Client HTTPS 배포 1. AWS Route53에 URL 등록 -> NS, SOA 유형의 URL 생성 2. AWS Route53의 NS 유형 URL에서 네임서버를 제공 -> 가비아에 등록 3. AWS 공인인증서 발급 시 적용할 URL을 2개 입력함 (www.cheongjici.com, cheongjigi.com) : Route53에 CNAME 유형 URL 2개 생성됨 4. 별칭 레코드 생성을 통해 A유형 URL 생성 : A URL 주소를 통해 Cloudfront URL과 공인인증서가 연동됨 참고 링크 : https://velog.io/@seongkyun/AWS-S3-CloudFront-Route53%EC%9D%84-%EC%9D%B4%EC%9A%A9%ED%95%9C-%EC%A0%95%EC%A0%81.. 2022. 9. 30.
[Front-end] 에러 메시지에 따른 조건부 처리 (err.message) 서버에서 클라이언트로 여러 유형의 에러 메시지를 보내게 됩니다. (500, 404, 401) 그 중 특정 에러를 별도로 처리해야 할 경우가 있습니다. 저는 인증과 관련된 401 에러가 발생했을 경우, 기존 토큰을 삭제하는 코드를 실행시키고자 했습니다. err객체 내의 message 프로퍼티를 활용하여 이를 해결했습니다. (err.message) axios.post(`${process.env.REACT_APP_SERVER_API}/api`, { token: token }) .then(res => { setIsOpened(false) }) .catch(err=>{ if (err.message = "Request failed with status code 401") { dispatch(deleteToken().. 2022. 9. 30.
[JavaScript] async/await을 array.map에 사용 시 Promise { <pending> } 에러 array.map 메소드에 async-await을 적용하자 Promise{}에러가 발생했다. // orderList는 주문 데이터가 담긴 배열 const data = await orderList.map(async (order) => { const itemData = await Order_item.findAll({ where: { Order_id: order.id } }) const itemList = itemData.map(el => el.dataValues) order.itemList = itemList return order }) 원인 async 함수는 Promise를 리턴하기 때문에 발생한 에러이다. map 함수가 호출한 async 함수는 Promise를 리턴한다. 그리고 map 함수는 이 Prom.. 2022. 8. 10.
[JavaScript] 이중(중첩) 반복문에서 상위 반복문 break/continue JavaScript에서 중첩 반복문(nested loop)을 사용하는 경우가 있습니다. 이중 for문이 그 예시입니다. 중첩 반복문을 사용할 경우 하위 반복문에서 break/continue 사용 시, 하위 반복문에만 그 효과가 적용됩니다. 나아가 여기서는 하위 반복문에서 상위 반복문에 break/continue 효과를 적용하는 방법을 포스팅했습니다. 1. 하위 반복문에서 break/continue 사용 for (let i=0; i 2022. 8. 10.
[React] 이벤트핸들러(event handler)에 event 외에 추가 인자 전달하기 이벤트 핸들러(Event Handler)에 합성 이벤트 객체(event) 외에 추가적인 매개변수를 전달하는 방법을 알아보자. 먼저 event 객체만 전달하는 방법부터 살펴보자. 1. event 객체만 전달하기 클릭 2. event 객체 외 다른 매개변수만 전달하기 {eventHandler(parameter)}}> 클릭 3. event 객체와 추가 매개변수를 함께 전달하기 {eventHandler(event, parameter)}}> 클릭 2022. 8. 10.
[코딩테스트] Police chase - Queue (JavaScript) 문제 Police officer Daniel has been informed of the location of a suspect and wants to catch him immediately. He starts at a point N on a number line and the suspect is at a point M on the same number line. Police officer has two modes of transportation: walking and teleporting. Walking: Police officer can move from any point X to the point X-1 or X+1 in a single minute. Teleporting: Police office.. 2022. 2. 7.
[코딩테스트] sumOfSubOrdinates - DFS (JavaScript) 문제 There is a company in which the relationships of employees are hierarchical. For example, If there is a subordinate B whose boss is A, then B's subordinate C is also a subordinate of A. A HR staff wants to know the total number of subordinates for a specific employee in the company. Complete a function that returns the sum of subordinates of employee from hierarchcy.Each employee cannot be du.. 2022. 2. 7.
반응형