-
Why do I get "Cannot find module '@nestjs/swagger'" in NestJS? |
Beta Was this translation helpful? Give feedback.
Answered by
TatyOko28
Feb 9, 2025
Replies: 1 comment
-
This happens when Swagger is not installed. Solution: Install Swagger module npm install @nestjs/swagger swagger-ui-express Then, set up Swagger in main.ts: import { SwaggerModule, DocumentBuilder } from "@nestjs/swagger";
const config = new DocumentBuilder()
.setTitle("API Docs")
.setDescription("My API description")
.setVersion("1.0")
.build();
const document = SwaggerModule.createDocument(app, config);
SwaggerModule.setup("api", app, document); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Mercure28
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This happens when Swagger is not installed.
Solution: Install Swagger module
Then, set up Swagger in main.ts: