codestates / codestates/Senna-server

[Error] Cannot use import statement outside a module

Open
#9 0 comments 0 reactions 0 assignees View on GitHub
Error
Dominant language
JavaScript
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

### 어떤 에러인가요?
es6 문법으로 module import 할 때 발생한 에러

![image](https://user-images.githubusercontent.com/77980674/123217475-923dab80-d505-11eb-9389-615fc9f720b0.png)

### $ 터미널의 에러 코드를 여기 넣어주세요.
-
```
import mongoose from "mongoose";
```

### 에러 핸들링 방법
- package.json에 type을 module로 설정해준다.
type이 설정되어 있지 않으면 default로 common js의 require 방식이 설정된다.
```
"type": "module",
```

### 에러 핸들링을 위해 참고한 레퍼런스 링크
https://gwang920.github.io/error/js-error(1)/

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.