Visual Studio 2017 throws compilation error in TypeScript file using angular 2 -


i trying create angular 2 app

below typescript code

import { component } 'angular2/core'; @component({     selector: 'my-app',     template: ' < h1 > first sharepoint add in using angular2... !!! < /h1>' }) export class appcomponent { } 

it throwing below errors

cannot find module angular2/core

experimental support decorators feature subject change in future release

for second error have added

"experimentaldecorators": true, 

in tsconfig.json

i have installed typescript sdk visual studio 2017 , restarted visual studio, no luck

i tried npm install -g typescript@latest

below package.json

{   "name": "imageslideshow",   "version": "1.0.0",   "description": "slide show 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 try npm install below message enter image description here

  1. make sure have run npm install on project , dependencies available in node_modules folder.

  2. in package.json file have dependencies both angular version 2 , 4. decide 1 want use.

if want use angular version 4 import should be:

import { component } '@angular/core'; 

Comments

Popular posts from this blog

Add new key value to json node in java -

javascript - Highcharts Synchronized charts with missing data points -

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -