일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
- Window redis-cli
- Ngrinder Docker
- 한 번에 끝내는 AWS 인프라 구축과 DevOps 운영 초격차 패키지 Online
- gitlab 잔디옮기기
- AWS S3 migration
- Redis
- Avast 구독취소
- 직장인자기계발
- 패캠챌린지
- 패스트캠퍼스
- 환급챌린지
- 잔디이전
- nodemailer
- redis-cli
- ERR unknown command 'JSON.GET'
- 직장인인강
- 캐시백챌린지
- RedisJSON
- 패스트캠퍼스후기
- redis cli
- aws s3
- 캐시백
- putty Inactive
- AWS S3 버킷 삭제
- elastic cache
- aws
- Avast Security
- AWS S3 계정이동
- vscode
- ERR unknown command 'JSON.SET'
- Today
- Total
Developing
nanoid [ERR_REQUIRE_ESM] 해결방법 : (package version에 따른 commonJS 미지원 이슈) 본문
nanoid [ERR_REQUIRE_ESM] 해결방법 : (package version에 따른 commonJS 미지원 이슈)
DEV_BLOG 2022. 10. 26. 20:45Unique ID generator용으로 사용되는 nanoid package를 불러오는 과정에서 [ERR_REQUIRE_ESM] 에러가 발생하였다.
const nanoid = require("nanoid"); // ERROR : [ERR_REQUIRE_ESM]
해당 에러는 4.0 버전부터 CommonJS에 대한 제공을 해주지 않기 때문이며, 4.0부터는 ES Module 문법만을 지원한다.
https://github.com/ai/nanoid/blob/main/CHANGELOG.md
GitHub - ai/nanoid: A tiny (130 bytes), secure, URL-friendly, unique string ID generator for JavaScript
A tiny (130 bytes), secure, URL-friendly, unique string ID generator for JavaScript - GitHub - ai/nanoid: A tiny (130 bytes), secure, URL-friendly, unique string ID generator for JavaScript
github.com
만약 CommonJS를 사용하면서 nanoid를 사용하고 싶다면 Package Downgrade를 진행해주자.
npm uninstall nanoid #현재 version 4.0 이상이라면 제거
npm install nanoid@^3.0.0
HOW TO FIx code : 'ERR_REQUIRE_ESM' const { nanoid } = require("nanoid");
how to fix it , I'm doing App chat . Sorry if the language is difficult to read, I'm Thai. PS C:\Users\ADMIN\Desktop\chat\server> node server.js C:\Users\ADMIN\Desktop\chat\server\server.js:4 co...
stackoverflow.com
'Trouble Shooting' 카테고리의 다른 글
Authy 기기변경시 Encrypted Accounts 해결방법 (0) | 2023.06.02 |
---|---|
nodemailer Error: self signed certificate in certificate chain 해결방법 (0) | 2022.11.10 |
node 'request.cookies' undefined 현상 해결방법 (0) | 2022.08.29 |
Redis 적용시 connection failed 해결방법 (node repo) (0) | 2022.08.24 |
nodemailer wrong version number 해결방법 (0) | 2022.08.13 |