I am going through the step by step tutorial on angular.io (Angular 2). I am using typescript. I get the following error when trying to compile:
Cannot find ex
Why is this error occuring?
make sure you have this file : https://github.com/borisyankov/DefinitelyTyped/blob/master/angular2/angular2.d.ts included in your project (recommend using tsconfig.json : https://github.com/TypeStrong/atom-typescript/blob/master/docs/tsconfig.md)
Adding these files to the head will give you the latest working version of Angular2.
<script src="https://github.jspm.io/jmcriffey/bower-traceur-runtime@0.0.87/traceur-runtime.js"></script>
<script src="https://jspm.io/system@0.16.js"></script>
<script src="https://code.angularjs.org/2.0.0-alpha.26/angular2.dev.js"></script>
Source: Angular.io: 5 Minute Quickstart
If you are running a meteor-angular2 application my solution will help you; simply add the below line into your typescript app.ts before import statements:
/// <reference path="typings/angular2-meteor/angular2-meteor.d.ts" />
The TypeScript Definition (TSD) for Angular2 is missing:
- cd src //go to the directory where your ts-file is
- tsd install angular2 //load Angular2 TypeScript Definition
Then compile again (e.g. tsc -p src -w
)
If tsd
fails install it first:
npm install -g tsd@^0.6.0