here is the problem I encounter when I launch my nest server:
back-end/node_modules/@nestjs/common/decorators/core/optional.decorator.js:22
const args = Reflect.getMetadata(constants_1.OPTIONAL_DEPS_METADATA, target) || [];
^
TypeError: Reflect.getMetadata is not a function
at /Users/lucabento-versace/OneDrive-Ynov/Projets/3eme_annee/WEB/TrueEat/back-end/node_modules/@nestjs/common/decorators/core/optional.decorator.js:22:34
at /Users/lucabento-versace/OneDrive-Ynov/Projets/3eme_annee/WEB/TrueEat/back-end/node_modules/@nestjs/common/node_modules/tslib/tslib.js:104:41
at Object.__decorate (/Users/lucabento-versace/OneDrive-Ynov/Projets/3eme_annee/WEB/TrueEat/back-
end/node_modules/@nestjs/common/node_modules/tslib/tslib.js:99:99)
at Object.<anonymous> (/Users/lucabento-versace/OneDrive-Ynov/Projets/3eme_annee/WEB/TrueEat/back-end/node_modules/@nestjs/common/services/console-logger.service.js:204:43)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
I tested this in vain : npm i reflect-metadata
I have already looked at the questions about the same error but I can't find any solutions
As user @hhearts already mentioned in the comment above, that's usually resolved by importing "reflect-metadata" into the global namespace (then you only have to do it once.
But you can do it as scoped as you need it.
For (p)react you can do it for example as the first import in App.ts
import "reflect-metadata";
export const App: FunctionalComponent = () => {
(...)
}
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