codestates / codestates/SIMSIMAE-server
[Error] sequelize-auto 사용시 init-models.js import 오류
Open
Nobody has claimed this yet.
completed
error
- Dominant language
- JavaScript
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
어떤 에러인가요?!
init-models.js 파일을 사용하고자 하는 js 파일에서 import해서 불러왔을 때 sequelize is not defined에러 발생

const initModels = require('../../models/init-models');
const models = initModels
에러 핸들링 방법
방법1)
- 아래와 같이 sequelize를 import 해왔는데
sequelize is not a function오류 발생
const sequelize = require('sequelize')
방법2) - solution
- sequelize를 models 디렉토리에서 import 해왔더니 init-models.js를 불러와 연동된 테이블을 불러올 수 있었다.
const { sequelize } = require('../../models');
const initModels = require('../../models/init-models');
에러 핸들링을 위해 참고한 레퍼런스 링크
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the import from the issue with models/init-models.js and the models directory export. Compare the failing direct import with the shown require('../../models') workaround, and consult the linked sequelize-auto issue and package documentation. Done means the intended import path and expected behavior are clearly established and verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100