BaGyun
빠균's 개발노트
BaGyun
전체 방문자
오늘
어제
  • 분류 전체보기 (71)
    • Today I Learned (44)
      • 오류 (8)
      • JavaScript (15)
      • TypeScript (9)
      • NodeJS (0)
      • NestJS (0)
      • Database (3)
      • ORM (1)
      • 알고리즘 (2)
      • 개인공부 (4)
      • Deploy (0)
      • Git (1)
    • 개인프로젝트 (4)
    • 알고리즘 (14)
      • 프로그래머스 (14)
    • 면접질문 (5)
    • 회고 (3)

인기 글

반응형

블로그 메뉴

  • 홈
  • 태그
  • 방명록
hELLO · Designed By 정상우.
BaGyun

빠균's 개발노트

Today I Learned/오류

[Error] Cannot use import statement outside a module

2022. 8. 5. 19:28

어떤 에러인가요?

module 을 import 할 때 발생하는 오류

에러 메세지

SyntaxError: Cannot use import statement outside a module

에러 핸들링 방법

import * from '*' 형식으로 import를 하고싶다면 package.json 파일에

“type” : “module” 을 추가해주면 오류가 해결된다.

{
  "name": "server",
  "version": "1.0.0",
  "type": "module",
  "description": "",
  "main": "app.js",
}

'Today I Learned > 오류' 카테고리의 다른 글

[Error] Apollo Server requires either an existing schema, modules or typeDefs  (0) 2022.10.19
[Error] Missing "driver" option. In the latest version of "@nestjs/graphql" package (v10) a new required configuration property called "driver" has been introduced. Check out the official documentation for more details on how to migrate  (0) 2022.10.19
[Error] 서버 실행 시 발생하는 에러  (0) 2022.07.08
[Error] sequelize-auto를 사용했을 때, initModels파일로 테이블들을 Join할 때 마주하는 오류  (0) 2022.07.08
[Error] sequelize-auto를 사용 했을 때, associate 지정을 따로 해주지않고 사용하는 법  (0) 2022.07.08
    'Today I Learned/오류' 카테고리의 다른 글
    • [Error] Apollo Server requires either an existing schema, modules or typeDefs
    • [Error] Missing "driver" option. In the latest version of "@nestjs/graphql" package (v10) a new required configuration property called "driver" has been introduced. Check out the official documentation for more details on how to migrate
    • [Error] 서버 실행 시 발생하는 에러
    • [Error] sequelize-auto를 사용했을 때, initModels파일로 테이블들을 Join할 때 마주하는 오류
    BaGyun
    BaGyun

    티스토리툴바