[nodejs] Warning: To load an ES module, set "type": "module" in the package.json
문제 상황 node로 코드 실행 시 아래 에러 발생 Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension. 원인 node.js에서 import, export와 같은 ES 모듈을 사용하려면 package.json 파일 설정을 통해 전체 파일에 적용해야 함. 해결 package.json에 "type": "module" 값을 추가 한다. //package.json { "name": "test", "version": "1.0.0", "description": "", "main": "index.js", "type": "module", }
개발/ETC
2022. 1. 14. 15:37