【发布时间】:2017-07-28 06:41:15
【问题描述】:
我正在尝试创建一个 Angular 2 应用程序
下面是打字稿代码
import { Component } from 'angular2/core';
@Component({
selector: 'my-app',
template: ' < h1 > My First SharePoint Add In using Angular2... !!! < /h1>'
})
export class AppComponent { }
它抛出以下错误
找不到模块 angular2/core
对装饰器的实验性支持是一项可能会在未来版本中更改的功能
第二个错误我也加了
"experimentalDecorators": true,
在 tsconfig.json 中
我还安装了TypeScript SDK for Visual Studio 2017 并重新启动了 Visual Studio,但没有运气
我也试过npm install -g typescript@latest
下面是我的 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"
}
【问题讨论】:
-
尝试运行'npm install'
-
是的,我试过
npm install -g typescript@latest -
不是 npm install -g 而是 npm install 在您的解决方案或您拥有软件包的子目录中
-
您的
package.json文件是什么样的? -
@Saravana 现在将其添加到问题中
标签: visual-studio angular typescript visual-studio-2017