Angular2 exception: Token must be defined
This is another error that has caught me multiple times. I forgot (once again) to export my root component. It should be:
export class AppComponent {
If I taken the time to look just a bit more closely at the stack trace (instead of searching StackOverflow and not finding my exact problem), I would have noticed that it referenced one of the files I wrote, boot.ts:4
.
Just for anyone else coming here looking for any light with this very general error message, I was receiving this message from one of my test spec files because there was a mock service defined at the bottom of the same spec file, just moved it to the top (before the test definition) and now everything is working as expected.
In my case that was just because of semi-colon at the end of following line:
import {Component} from 'angular2/core';