아래와 같은 오류를 만났다.
[Nest] 21927 - 2021. 11. 09. 오후 3:38:42 LOG [InstanceLoader] TypeOrmCoreModule dependencies initialized +47ms
[Nest] 21927 - 2021. 11. 09. 오후 3:38:42 LOG [InstanceLoader] TypeOrmModule dependencies initialized +1ms
[Nest] 21927 - 2021. 11. 09. 오후 3:38:42 LOG [InstanceLoader] AuthModule dependencies initialized +0ms
[Nest] 21927 - 2021. 11. 09. 오후 3:38:42 LOG [InstanceLoader] UsersModule dependencies initialized +1ms
[Nest] 21927 - 2021. 11. 09. 오후 3:38:42 LOG [InstanceLoader] AppModule dependencies initialized +0ms
/Users/xii/src/main.ts:28
app.use(cookieParser());
^
TypeError: (0 , cookie_parser_1.default) is not a function
at bootstrap (/Users/im-uchan/Desktop/~~~~~/src/main.ts:28:23)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
import cookieParser from 'cookie-parser';
//...........
app.use(cookieParser());
import때문에 발생한 문제이다.
tsconfig.json에 들어가 "esModuleInterop": true
를 추가해주자.
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true, // 추가
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"skipLibCheck": true,
"strictNullChecks": false,
"noImplicitAny": false,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false
}
}
감사합니다 선생님