After creating an Angular2 component, I wanted to share the code with my colleagues. Therefore, I uploaded the code to Github, cloned the repository, ran npm install
, and then npm run tsc
. However, I encountered the following errors:
error TS2318: Cannot find global type 'Promise'.
...
This is a rundown of my npm setup:
"dependencies": {
"@angular/common": "~2.4.0",
...
},
"devDependencies": {
"jasmine": "^2.5.3",
...
}
As for my tsc-compiler configuration:
{
"compilerOptions": {
"target": "es5",
...
}, "exclude": ["node_modules"]
}
Despite trying various solutions like deleting node_modules/, typings/, and adjusting dependencies, I only received more error messages. Can anyone offer assistance? My end goal is for others to clone my repository, execute npm install
and npm run tsc
, and seamlessly begin development.
Update1: Changing the target from es5 to es6 resolved the promise-related errors, but jasmine errors persist:
src/other.service.spec.ts(122,3): error TS2304: Cannot find name 'expect'.
...
Update2:
By aligning the dependencies with the angular-quickstart (https://github.com/angular/quickstart/blob/master/package.json), the issues were resolved. Thank you for the guidance!