angular/benchpress-tree

Error: reflect-metadata shim is required when using class decorators

willbuck opened this issue · 4 comments

Hey Jeff!

I'm trying to get this code running to start playing around with Benchpress, but following your instructions to:

node install .
./node_modules/.bin/webdriver-manager update
/node_modules/.bin/protractor protractor.conf.js

I am getting the error in the issue title.

It would appear as if this is a common problem getting started with angular2 (which I know this project isn't), and I've so far been able to deduce that I probably need to

npm install --save-dev reflect-metadata

But I'm unsure where this needs to go in order for the spec to run (I've so far tried putting it in the public/tree.html file as a src tag, but that doesn't seem to be doing the trick)

I would appreciate any help you can spare in fixing this up and will gladly submit a pull request to solve the problem if one is so warranted (it's entirely possible I've made a mistake and no PR is necessary for others to run the code).

Not sure if this is helpful @willbuck but in the jspm + angular2 cheatsheet there is some info about including reflect-metadata. Since you're not using jspm you'd need to add the script tag manually then import 'reflect-metadata'; in your app if I am reading it correctly. If using jspm and systemjs then you could skip the adding of the script tag.

Thanks for the tip Jim! I will give that a shot and report back

On Sun, Jun 28, 2015, 10:12 PM Jim Cummins notifications@github.com wrote:

Not sure if this is helpful @willbuck https://github.com/willbuck but
in the jspm + angular2 cheatsheet
https://gist.github.com/robwormald/429e01c6d802767441ec there is some
info about including reflect-metadata. Since you're not using jspm you'd
need to add the script tag manually then import 'reflect-metadata'; in
your app if I am reading it correctly. If using jspm and systemjs then you
could skip the adding of the script tag.


Reply to this email directly or view it on GitHub
https://github.com/jeffbcross/benchpress-tree/issues/4#issuecomment-116405833
.

Your tip was on the right path @jimthedev!

Needed this at the top of my tree_benchmark.spec.js:

var reflect = require('reflect-metadata');

I will gladly submit a PR to close this issue :)

Merged @willbuck's fix: d3765bc thanks!