Nunna Suma
Nunna Suma

Reputation: 509

AG-Grid with Angular2. Error while installing the ag-grid in angular2 project

I'm new to angular2. In my basic angular2 project I trying to place ag-grid. I'm getting error

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 { }

In the app.module.ts file, withNg2ComponentSupport() it getting error.

Upvotes: 2

Views: 1386

Answers (1)

Sean Landsman
Sean Landsman

Reputation: 7187

From your message I'm guessing you're using angular 2 2.3+ - if so, then the problem is that ag-grid-ng2 6.x does not support this version.

Angular 2 made the RuntimeCompiler non-public (well, moved it etc) which ag-grid-ng2 relied on.

If you want to use Angular 2.3+ then you'll need to upgrade to ag-grid-ng2 7.x, which supports it

Upvotes: 3

Related Questions