Nest can't resolve dependencies of the SchedulerMetadataAccessor
catherine-rmdy opened this issue · 3 comments
Did you read the migration guide?
- I have read the whole migration guide
Is there an existing issue that is already proposing this?
- I have searched the existing issues
Potential Commit/PR that introduced the regression
N/A
Versions
1.0.2 -> 2.1.0
Describe the regression
@nestjs/schedule module is no longer working after upgrading all nestjs packages to the latest versions and node v18.7.0:
Nest can't resolve dependencies of the SchedulerMetadataAccessor (?). Please make sure that the argument Reflector at index [0] is available in the ScheduleModule context.
Minimum reproduction code
-
package.json
...
"@nestjs/apollo": "^10.0.22",
"@nestjs/common": "^9.0.11",
"@nestjs/config": "^2.2.0",
"@nestjs/core": "^9.0.11",
"@nestjs/graphql": "^10.0.22",
"@nestjs/jwt": "^9.0.0",
"@nestjs/platform-express": "^9.0.11",
"@nestjs/schedule": "^2.1.0",
"@nestjs/typeorm": "^9.0.1",
"@types/cron": "^2.0.0",
"apollo-server-core": "^3.10.1",
"apollo-server-express": "^3.10.1",
... -
app.module.ts
@module({
imports: [ScheduleModule.forRoot(), ...],
})
Expected behavior
Expected Nest to build when using @nestjs/schedule .
Other
No response
you problably got two versions of @nestjs/common
in your project. Run npm ls @nestjs/common
Share a minimum repro.
why reproductions are required
Thank you for the quick reply.
- Ran
yarn why @nestjs/common
, which gave me only one version > 9.0.11 - Deleted my dist-folder, threw away all my node-modules, reinstalled and rebuild the application (as suggested in a closed bug-ticket that related to this problem), but still no luck.
- I will try to come back with a minimum repo as soon as I was able to extract it out of my monorepo.
When trying to extract the code out, I noticed that the error came from the monorepo.workspaces.
Adding "@nestjs/common" to the "nohoist" option in package.json, solved it for me.
Thank you anyway for pointing me in the right direction.