找不到模块“angular2 / angular”

时间:2015-12-05 16:28:17

标签: angular typescript

我正在关注来自https://angular.io/guide/quickstart

的Angular js教程

我正在尝试使用此代码:

import {bootstrap, Component} from 'angular2/angular2';
@Component({
    selector: 'my-app',
    template: '<h1>My First Angular 2 App</h1>'
})
class AppComponent { }
bootstrap(AppComponent);

但是我收到了这个错误:

  

无法找到模块“angular2 / angular”

这是我的文件夹结构:

Image

1 个答案:

答案 0 :(得分:1)

for angular2的tsd实际上并没有在你的打字目录中创建打字文件,而是需要使用节点安装:

npm install -save angular2

然后在tsdconfig.json中,您需要在compilerOptions:

下启用节点模块解析
"moduleResolution": "node"
相关问题