![TypeError: ws.Server is not a constructor](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcqxiKx%2FbtrP7TwT6Er%2FlqxkRjGo3RQ9d8Uksz74MK%2Fimg.jpg)
TypeError: ws.Server is not a constructorJavaScript2022. 11. 1. 15:28
Table of Contents
728x90
웹소켓 서버를 생성 및 구동하려다 해당 오류를 만난다면 살짝만 수정해주면 된다.
ws 버전에 관한 문제
// 기존코드
import ws from "ws";
const wws = new ws.Server({
server: HTTPServer,
});
위 코드에서
// 수정코드
import ws, { WebSocketServer } from "ws";
const wws = new WebSocketServer({
server: HTTPServer,
});
위와 같이 변경하면 된다.
'JavaScript' 카테고리의 다른 글
Resizer.js (1) | 2023.11.18 |
---|---|
Uncaught SyntaxError: Invalid shorthand property initializer 해결 (0) | 2023.02.27 |
Javascript 날짜 계산기 (0) | 2023.01.31 |
Swiper <DevTools failed to load source map> (0) | 2022.12.08 |
Element Resize 시 window resize 이벤트 발생 속도 (0) | 2022.10.31 |
@요술공주밍키 :: 삽질의흔적
조금씩이라도 꾸준히..