node_modules/@angular/core/bundles/core.umd.js:501
var /** @type {?} */ meta = Reflect$1.getOwnMetadata('propMetadata', target.constructor) || {};
^
TypeError: Reflect$1.getOwnMetadata is not a function
at PropDecorator
@dkmostafa, are you sure your error is related to this library? From your stack trace it looks like you have an error in node_modules/bundles/core.umd.js (which is not included in this library)? Do you still get this error if you remove the import of ng-lazyload-image?
After i removed the ng-lazyload-image library , and removing it from the app.module.ts the project worked perfectley .
This is the full trace of the error .
TypeError: Reflect$1.getOwnMetadata is not a function
at PropDecorator (/project/node_modules/@angular/core/bundles/core.umd.js:501:51)
at __decorate (/project/node_modules/ng-lazyload-image/src/lazyload-image.directive.js:5:110)
at project/node_modules/ng-lazyload-image/src/lazyload-image.directive.js:62:5
at Object.
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
Yeah, after installing this plugin I have the same problem. @angular/cli build app via ng build --prod
, but when I try to execute code in server side above TypeError
occurs.
It happens with some dependencies:
https://github.com/angular/angular-cli/issues/7476
when using Universal
Somewhere there is a need for the metadata reflection API (getOwnMetadata) that Node does not support
I have done some googling and it seems to be a problem in angular-cli/universal rather than in this library. Please let me know if I'm wrong!
You need in your server.ts
file include this line at the top of imports import 'core-js/es7/reflect';
or import 'reflect-metadata';
Most helpful comment
You need in your
server.ts
file include this line at the top of importsimport 'core-js/es7/reflect';
orimport 'reflect-metadata';