Notice
Recent Posts
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- current_date
- 정규표현식
- update
- Effective Java
- git
- log_bin
- regex
- upgrade
- REACTJS
- Effective Java 3/e
- spring
- eslint
- MySQL
- Express
- log4j2
- npm
- expire_logs_days
- Chunk
- nodejs
- Spring Batch
- JavaScript
- migration
- Node
- REACT
- spring cloud
- java
- mysql 5.5
- 퀵소트
- Webpack
- Regular expression
Archives
- Today
- Total
내 세상
[NestJS] mysql connection pool Cannot read properties of undefined 이슈 조치 본문
Technical/NodeJS
[NestJS] mysql connection pool Cannot read properties of undefined 이슈 조치
sga8 2024. 7. 4. 07:08728x90
NestJS + mysql2 사용시, mysql 객체가 TypeError: Cannot read properties of undefined (reading 'createPool') 에러가 발생하는 경우가 있음.
import mysql from "mysql2/promise";
const _dbConn = mysql.createPool({});
export { _dbConn };
위와 같이 구현한 경우에 해당 에러가 발생함.
조치 방법은 아래와 같이 as로 import 구문을 변경해주면 됨.
import * as mysql from "mysql2/promise";
const _dbConn = mysql.createPool({});
export { _dbConn };
728x90
'Technical > NodeJS' 카테고리의 다른 글
[NodeJS] MySQL2 Error: Can't add new command when connection is in closed state. 해결 (0) | 2024.08.19 |
---|---|
[NodeJS] Material-React-Table 사용법 (0) | 2024.03.06 |
[NodeJS] 이유를 알 수 없는 오류 process is not defined (0) | 2024.02.22 |
[NodeJS] Package 비교, node-redis VS ioredis (0) | 2024.02.20 |
[NodeJS] CentOS 7 환경 NodeJS Offline 설치 (0) | 2024.02.16 |