Currently, I am in the process of developing a boilerplate NestJS application. My goal is to integrate @nestjs/swagger into the project. However, I have encountered an import error while trying to include the module.
npm install --save @nestjs/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6b181c0a0c0c0e192b5f4553455b">[email protected]</a> --force
I attempted the command above after receiving errors. I even tried deleting and reinstalling the node_modules directory, but unfortunately, none of these solutions are resolving the issue.
src/main.ts:2:44 - error TS1005: 'from' expected.
2 import { DocumentBuilder, SwaggerModule } '@nestjs/swagger'
~~~~~~~~~~~~~~~~~
[7:47:36 PM] Found 1 error. Watching for file changes.
Below is the content of the main.ts file:
import { NestFactory } from '@nestjs/core';
import { DocumentBuilder, SwaggerModule } '@nestjs/swagger'
import { AppModule } from './app.module';
import * as cookieParser from 'cookie-parser';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const options = new DocumentBuilder()
.setTitle('NestJS Middleware Test')
.setDescription('Implement a simple request interceptor for authorization')
.setVersion('0.0.1')
.build();
const document = SwaggerModule.createDocument(app, options)
SwaggerModule.setup('api', app, document)
app.use(cookieParser());
await app.listen(3000);
}
bootstrap();