node_modules/@angular/core/bundles/core.umd.js:501
var /** @type {?} */ meta = Reflect$1.getOwnMetadata('propMetadata', target.constructor) || {};
^
类型错误:Reflect$1.getOwnMetadata 不是函数
在 PropDecorator
@dkmostafa ,您确定您的错误与此库有关吗? 从您的堆栈跟踪来看,您似乎在 node_modules/bundles/core.umd.js(未包含在此库中)中有错误? 如果删除 ng-lazyload-image 的导入,您是否仍然收到此错误?
在我删除 ng-lazyload-image 库并将其从 app.module.ts 中删除后,该项目完美运行。
这是错误的完整踪迹。
类型错误:Reflect$1.getOwnMetadata 不是函数
在 PropDecorator (/project/node_modules/@angular/core/bundles/core.umd.js:501:51)
在 __decorate (/project/node_modules/ng-lazyload-image/src/lazyload-image.directive.js:5:110)
在项目/node_modules/ng-lazyload-image/src/lazyload-image.directive.js:62:5
在对象。
在 Module._compile (module.js:570:32)
在 Object.Module._extensions..js (module.js:579:10)
在 Module.load (module.js:487:32)
在 tryModuleLoad (module.js:446:12)
在 Function.Module._load (module.js:438:3)
在 Module.require (module.js:497:17)
是的,安装此插件后,我遇到了同样的问题。 @angular/cli 通过ng build --prod
构建应用程序,但是当我尝试在TypeError
以上的服务器端执行代码时。
它发生在一些依赖项中:
https://github.com/angular/angular-cli/issues/7476
使用通用时
某处需要 Node 不支持的元数据反射 API (getOwnMetadata)
我已经做了一些谷歌搜索,这似乎是 angular-cli/universal 中的一个问题,而不是这个库中的问题。 如果我错了,请告诉我!
您需要在server.ts
文件中将此行包含在导入import 'core-js/es7/reflect';
或import 'reflect-metadata';
的顶部
最有用的评论
您需要在
server.ts
文件中将此行包含在导入import 'core-js/es7/reflect';
或import 'reflect-metadata';
的顶部