Server side rendering "TypeError: Reflect$1.getOwnMetadata is not a function"
Bug Report or Feature Request (mark with an x)
- [ x ] bug report -> please search issues before submitting
- [ ] feature request
Versions.
@angular/cli: 1.3.1 node: 7.10.1 os: darwin x64
Repro steps.
Following the docs in https://github.com/angular/angular-cli/blob/1.3.x/docs/documentation/stories/universal-rendering.md
I get
/Users/lucaswxp/xxx/site/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 (/Users/lucaswxp/doare/site/node_modules/@angular/core/bundles/core.umd.js:501:51)
at __decorate (/Users/lucaswxp/doare/site/node_modules/angular2-text-mask/dist/angular2TextMask.js:5:110)
at Object.<anonymous> (/Users/lucaswxp/doare/site/node_modules/angular2-text-mask/dist/angular2TextMask.js:88:1)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
Not sure if it's a angular bug, but I followed all the steps mentioned in the docs. Any help?
Guys, I see this is an actual angular cli bug? Any idea how can I fix it temporarily?
Hello, any updates on this? I'm about to launch a big project and we need this working.
Appreciate the support.
@hansl appreaciate if you can give us a date estimate for this fix.
@hansl @ruyfortini Is there any temporary way around this bug? Anything at all I can do just to load my site somewhere?
@hansl @ruyfortini Quick update, I only get this error if I try to include this plugin: https://github.com/mujtaba01/ngx-owl-carousel. I assume that's not related to the bug but is instead a universal thing?
same problem with universal have you solved yet? @lucaswxp @EmptyPockets
I get this error message building an universal project without angular-cli, so I guess it is rather a platform-server issue.
I think it is because you are using a dependency that uses methods not supported in node: http://node.green/#ESNEXT-pre-strawman-Metadata-reflection-API-Reflect-getOwnMetadata
In your case is 'angular2-text-mask'
At server level you need to include a reflect polyfill such as reflect-metadata.
Please take a look at this story https://github.com/angular/angular-cli/wiki/stories-universal-rendering and this starter https://github.com/angular/universal-starter/blob/master/server.ts#L2
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.