TS2307:找不到模块'离子/离子'

pro*_*007 6 typescript tsc tsconfig ionic2 angular

tsc我尝试使用我的ionic2项目时,我在打字稿文件上收到以下错误.

错误: TS2307: Cannot find module 'ionic/ionic'


代码:

import {Page} from "ionic/ionic" //error happens on this line

@Page({
  templateUrl: 'app/list/list.html',
})
export class ListPage {
  constructor() {}
}
Run Code Online (Sandbox Code Playgroud)

我的tsconfig.json文件:

{
  "compilerOptions": {
    "target": "ES5",
    "module": "commonjs",
    "sourceMap": true,
    "isolatedModules": true,
    "noEmitOnError": false,
    "rootDir": ".",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true
  },
  "compileOnSave": false
}
Run Code Online (Sandbox Code Playgroud)

我的npm -g列表:

cordova@5.4.0
ionic@2.0.0-alpha.23
npm@3.4.1
typescript@1.6.2
Run Code Online (Sandbox Code Playgroud)

mha*_*ton 1

参见第 84 期

我们仍然需要为 ionic 2 创建一个定义文件。所以在那之前,typescript 编译器会发出很多声音,但它仍然会正确编译代码。