I am using @nestjs/passport. After running npm run start:dev
I got an error, but the editor doesn't show an error
node_modules/@nestjs/passport/dist/passport/passport.serializer.d.ts:1:27 - error TS2307: Cannot find module 'passport' or its corresponding type declarations.
1 import * as passport from 'passport';
Input Code:
import { PassportModule } from '@nestjs/passport';
import { TypeOrmModule } from '@nestjs/typeorm';
import { Module } from '@nestjs/common';
import { AuthController } from './auth.controller';
import { AuthService } from './auth.service';
import { UserRepository } from './user.repository';
import { JwtModule } from '@nestjs/jwt';
@Module({
imports:[
PassportModule.register({defaultStrategy:'jwt'}),
JwtModule.register({
secret: 'topSecret51',
signOptions:{
expiresIn:3600,
},
}),
TypeOrmModule.forFeature([UserRepository]),
],
controllers: [AuthController],
providers: [AuthService],
})
export class AuthModule {}
Any idea what the problem could be?
I had the same problem. But I did a rebuild and everything worked.
Removed the dist
folder and then start again
rm -r dist
npm run start:dev
this error occurs due to the node version. if you got this, update node version and reinstall passport module using npm i --save @nestjs/passport passport
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With