首页 文章

带有Angular2的AG-Grid . 在angular2项目中安装ag-grid时出错

提问于
浏览
2

我是angular2的新手 . 在我的基本angular2项目中,我试图放置ag-grid . 我收到了错误

node_modules/ag-grid-ng2/lib/ng2ComponentFactory.d.ts(3,10): error TS2305: Module 
'"C:/practice/quickstart/node_modules/@angular/compiler/index"' has no exported member 'RuntimeCompiler'.

的package.json

"ag-grid": "6.4.x",
    "ag-grid-enterprise": "6.4.x",
    "ag-grid-ng2": "6.4.x",

systemjs.config.js

'ag-grid': 'node_modules/ag-grid',
'ag-grid-ng2': 'node_modules/ag-grid-ng2'

packages: {
      'ag-grid-ng2': {
        defaultExtension: "js"
      },
      'ag-grid': {
        defaultExtension: "js"
      },
    }

app.module.ts

import {AgGridModule} from 'ag-grid-ng2/main';
@NgModule({
  imports:      [ 
    BrowserModule,
    AgGridModule.withNg2ComponentSupport(),
  ],
  declarations: [ AppComponent ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }

在app.module.ts文件中,withNg2ComponentSupport()收到错误 .

1 回答

  • 3

    从你的消息我猜你正在使用angular 2 2.3 - 如果是这样,那么问题是ag-grid-ng2 6.x不支持这个版本 .

    Angular 2使得Run-Compiler非公开(好吧,移动它等)ag-grid-ng2所依赖的 .

    如果你想使用Angular 2.3,你需要升级到ag-grid-ng2 7.x,它支持它

相关问题