Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- npx
- docker
- CDN
- cicd
- sequelize
- socket.io
- styled-component
- Modal
- Recoil
- 웹팩
- 포트포워딩
- 웹크롤링
- 회고
- graphql
- typescript
- Redux
- 반응형웹
- react
- express
- 성능최적화
- scrapping
- javascript animation
- route
- component
- 정규표현식
- go
- AWS
Archives
- Today
- Total
프로그래밍 공부하기
nodejs Debug Error : Unexpected token '.' 본문
/usr/local/bin/node ./app.js
SyntaxError: Unexpected token '.'
process exited with code 1
오랜만에 nodeJS를 디버깅을 하려는데 위와 같은 형식의 에러가 발생한다. 분명히 전에도 디버깅했던 프로젝트인데 무슨일인걸까..ㅜㅜ
의심가는 것은 내가 최근에 node를 12로 낮췄다는 것인데...
Importing in Node.js: error "Must use import to load ES Module"
I'm trying to import myArr from hello.js into index.js. However I get an error of Error [ERR_REQUIRE_ESM]: Must use import to load ES Module File hello.js export let myArr = ['hello', 'hi', 'hey'];
stackoverflow.com
스택오버플로우에 찾아보니 ES6 모듈을 디버깅하기 위해선 2가지 조건이 필요한 것 같다.
- node 14 버전 이상
- package.json 에서 "type": "module" 넣어주기
'ErrorLog' 카테고리의 다른 글
nvm: install failed! python: not found (mac m1) (0) | 2022.08.18 |
---|---|
DOM에서 사라진 요소는 dragEnd 이벤트가 발생할 수 없다. (0) | 2022.03.13 |
Jest에서 ES6 모듈 사용하기 (Expriemental Suport) (1) | 2021.09.04 |
ESLint / Prettier가 작동 안 됨 (ES Module) (0) | 2021.08.24 |
브라우저별 Full Screen (0) | 2021.08.08 |