Reputation: 7299
I am trying to create an angular 2 app
Below is the typescript code
import { Component } from 'angular2/core';
@Component({
selector: 'my-app',
template: ' < h1 > My First SharePoint Add In using Angular2... !!! < /h1>'
})
export class AppComponent { }
It is throwing the below errors
cannot find module angular2/core
Experimental support for decorators is a feature that is subject to change in a future release
For the second error I have also added
"experimentalDecorators": true,
in the tsconfig.json
I have also installed TypeScript SDK for Visual Studio 2017 and restarted Visual studio, but no luck
I also tried npm install -g typescript@latest
Below is my package.json
{
"name": "imageslideshow",
"version": "1.0.0",
"description": "slide show for image libraries",
"main": "index.js",
"dependencies": {
"@angular/core": "^4.3.2",
"angular2": "^2.0.0-beta.17",
"es6-promise": "^4.1.1",
"es6-shim": "^0.35.3",
"reflect-metadata": "^0.1.2",
"rxjs": "^5.0.0-beta.6",
"systemjs": "^0.20.17",
"zone.js": "^0.8.16"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "vignesh",
"license": "ISC"
}
When I try npm install I get the below message
Upvotes: 0
Views: 652
Reputation: 40712
Make sure you have run npm install
on your project and the
dependencies are available in the node_modules
folder.
In your package.json file you have dependencies with both Angular version 2 and 4. Decide which one you want to use.
If you want to use Angular version 4 your import should be:
import { Component } from '@angular/core';
Upvotes: 1