Comments (8)
TLDR; make sure you use the latest version (so the reflect-metadata
version is in sync)
from nest.
Thanks, I have ran: npx npm-check-updates -u
but I still have the same problem.
Here are my updated dependencies:
"dependencies": {
"@nestjs/common": "^10.3.3",
"@nestjs/config": "^3.2.0",
"@nestjs/core": "^10.3.3",
"@nestjs/platform-express": "^10.3.3",
"@nestjs/typeorm": "^10.0.2",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"pg": "^8.11.3",
"reflect-metadata": "^0.2.1",
"rxjs": "^7.8.1",
"typeorm": "^0.3.20",
"uuid": "^9.0.1",
"winston": "^3.12.0"
},
"devDependencies": {
"@nestjs/cli": "^10.3.2",
"@nestjs/schematics": "^10.1.1",
"@nestjs/testing": "^10.3.3",
"@types/express": "^4.17.21",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.24",
"@types/supertest": "^6.0.2",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.7.0",
"prettier": "^3.2.5",
"source-map-support": "^0.5.21",
"supertest": "^6.3.4",
"ts-jest": "^29.1.2",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.3.3"
},
from nest.
Please, provide a minimum reproduction repository.
You can also try removing the lock file & node_modules folder and re-running npm install
from nest.
So I have tried to provide a reproduction on Stackblitz, the problem is that it can't connect to DB so it throws an error an won't run. I can add once again my very basic app.controller and app.module.
regarding the deletion of node modules and re-run npm i - I have already done it and it didn't solve.
Thanks for your efforts !
my app.controller:
@Controller('app')
export class AppController {
constructor(private readonly appService: AppService) {}
@Get('/:id')
getHello(@Param('id') id: string): string {
console.log(id);
return this.appService.getHello();
}
}
my app.module:
@Module({
imports: [
UsersModule,
ScheduleModule.forRoot(),
CacheModule.register({ isGlobal: true }),
HttpModule,
ConfigModule.forRoot({
isGlobal: true,
envFilePath: ['.env.dev'],
}),
TypeOrmModule.forRootAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: async (configService: ConfigService) => ({
type: 'postgres',
autoLoadEntities: true,
synchronize: true,
host: configService.get('DB_HOST'),
port: configService.get('DB_PORT'),
username: configService.get('DB_USERNAME'),
password: configService.get('DB_PASSWORD'),
database: configService.get('DB_DATABASE'),
}),
}),
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
from nest.
For me @kamilmysliwiec's suggestion worked.
@moshicohen I updated my project to use all the dependencies you listed and my controller's still worked. Maybe inspect your package-lock.json and ensure the correct reflect-metadata version is being used and something else isn't pulling in 0.1.12.
from nest.
You are right guys, it was finally the version pf reflect-metadata.
When I ran: npx npm-check-updates -u it didn't update it.
I had to manually: npm install reflect-metadata@^0.2 and it solved it.
Thanks !
from nest.
Related Issues (20)
- Improve experience when initialisation error occurs HOT 1
- When I introduce a configuration file from outside the project, an error occurs: Cannot find module HOT 3
- circular dependecy error due to reflect-metadata dependency HOT 1
- Validation Pipe is not executed HOT 2
- Use multiple env files HOT 1
- Calling grpcClient.start in server-grpc is no longer necessary since version 1.10.x HOT 2
- Error: Unknown authentication strategy "jwt" for Project with multi apps projects HOT 11
- How can I override nest's default logger using the fastify adapter's built-in logger? HOT 1
- Param decorator not extracting value when TypeOrmModule is imported to a module HOT 1
- Add path alias to nest new HOT 10
- examples: Consider upgrading GraphQL example to demonstrate field resolvers HOT 1
- Unable to run application after install @nestjs/platform-express HOT 3
- Calling a service cause app to use 100% CPU
- Add custom exception on Versioning HOT 1
- New project setup is failing
- Add a ParseNullPipe to the common library HOT 1
- Security Vulnerability on NestJS HOT 5
- double middleware execuation HOT 5
- Exclude Global Prefix + Middleware leads to wrong params HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nest.