Angular2 ag-grid-enterprise 项目在放置许可证密钥时出现问题

Angular2 ag-grid-enterprise project having issue while placing License Key

我有 ag-grid-enterprise 版本的许可证,但我不知道如何放置它以及如何在我的 angular2 项目中导入企业。

我正在尝试使用 licenseManager 将许可证放入 main.ts 文件中 并将企业版本放在 package.json 和 systemjs.config.json

但我收到错误

systemjs.config.js:

'ag-grid': 'node_modules/ag-grid',
'ag-grid-ng2': 'node_modules/ag-grid-ng2',
'ag-grid-enterprise': 'node_modules/ag-grid-enterprise'
'ag-grid': {
   defaultExtension: "js"
 },
 'ag-grid-ng2': {
   defaultExtension: "js"
 },
 'ag-grid-enterprise': {
   defaultExtension: "js"
 }

Package.json

"dependencies": {
    "ag-grid": "7.1.x",
    "ag-grid-enterprise": "7.1.x",
    "ag-grid-ng2": "7.1.x",

    "@angular/common": "2.4.x",
    "@angular/compiler": "2.4.x",
    "@angular/compiler-cli": "2.4.x",
    "@angular/core": "2.4.x",
    "@angular/http": "2.4.x",
    "@angular/forms": "2.4.x",
    "@angular/platform-browser": "2.4.x",
    "@angular/platform-browser-dynamic": "2.4.x",
    "@angular/platform-server": "2.4.x",
    "@angular/router": "3.4.x",
    "rxjs": "5.0.x",
    "zone.js": "0.7.x",
    "core-js": "2.4.x",
    "systemjs": "0.19.27",
    "bootstrap": "3.3.6",
    "jquery": "3.1.1"
  },
  "devDependencies": {
    "@types/node": "6.0.45",
    "concurrently": "2.2.0",
    "typescript": "2.0.3",
    "rimraf": "2.5.x",
    "gulp": "3.9.1",
    "lite-server": "2.2.2",
    "systemjs-builder": "0.15.33",
    "copyfiles": "1.0.x",
    "ncp": "2.0.x",

    "@types/selenium-webdriver": "2.53.33",
    "http-server": "^0.9.0",
    "canonical-path": "0.0.2",
    "jasmine-core": "2.4.1",
    "karma": "1.3.0",
    "karma-chrome-launcher": "2.0.0",
    "karma-cli": "1.0.1",
    "karma-jasmine": "1.0.2",
    "karma-jasmine-html-reporter": "0.2.2",
    "karma-systemjs": "0.16.0",
    "protractor": "4.0.13",
    "webdriver-manager": "10.2.5"
  }

main.ts

import {LicenseManager} from "ag-grid-enterprise/main";
LicenseManager.setLicenseKey("your license key");

“错误:错误:加载 XHR 错误(404 未找到)http://localhost:3000/node_modules/ag-grid 在 XMLHttpRequest.wrapFn [作为 _onreadystatechange] (http://localhost:3000/node_modules/zone.js/dist/zone.js:1039:29) [] 在 Zone.runTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:151:47) [=>] 在 XMLHttpRequest.ZoneTask.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:345:33) [] 从 http://localhost:3000/node_modules/ag-grid-enterprise/dist/lib/menu/enterpriseMenu.jshttp://localhost:3000/node_modules/ag-grid 加载为 "ag-grid" 时出错 在 addToError (http://localhost:3000/node_modules/systemjs/dist/system.src.js:123:78) [] 在 linkSetFailed (http://localhost:3000/node_modules/systemjs/dist/system.src.js:726:21) [] 在 http://localhost:3000/node_modules/systemjs/dist/system.src.js:522:9 [] 在 Zone.run (http://localhost:3000/node_modules/zone.js/dist/zone.js:113:43) [=>] 在 http://localhost:3000/node_modules/zone.js/dist/zone.js:535:57 [] 在 Zone.runTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:151:47) [=>] 在 drainMicroTaskQueue (http://localhost:3000/node_modules/zone.js/dist/zone.js:433:35) [] 在 XMLHttpRequest.ZoneTask.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:349:25) []"

尝试引用真实的ag-grid主js文件

System.config({
    defaultJSExtensions: true,
    map: {
        // angular libraries

        // ag libraries
        'ag-grid-ng2': 'node_modules/ag-grid-ng2',
        'ag-grid': 'node_modules/ag-grid',
        'ag-grid-enterprise': 'node_modules/ag-grid-enterprise'
    },
    packages: {
       // code ...
       'ag-grid': {
            main: 'main.js'
        }
    }
});