构建应用程序后出错:使用Angular 6进行ag-grid

时间:2018-05-10 12:40:08

标签: angular ag-grid

我正在使用带有角度6的ag-grid,所以一切正常,但是当我使用ng build构建我的应用程序时,它已成功构建,但是当我运行我的应用程序时 我收到了这个错误:

ERROR TypeError: Cannot read property 'AG_GRID' of undefined at ComponentProvider.push.../node_modules/ag-grid/dist/lib/components/framework/componentProvider.js.ComponentProvider.retrieve (main.cd682685b0beea93bbaf.js:48587)
    at ComponentResolver.push.../node_modules/ag-grid/dist/lib/components/framework/componentResolver.js.ComponentResolver.resolveByName (main.cd682685b0beea93bbaf.js:48969)
    at ComponentResolver.push.../node_modules/ag-grid/dist/lib/components/framework/componentResolver.js.ComponentResolver.getComponentToUse (main.cd682685b0beea93bbaf.js:48965)
    at ComponentResolver.push.../node_modules/ag-grid/dist/lib/components/framework/componentResolver.js.ComponentResolver.newAgGridComponent (main.cd682685b0beea93bbaf.js:49087)
    at ComponentResolver.push.../node_modules/ag-grid/dist/lib/components/framework/componentResolver.js.ComponentResolver.createAgGridComponent (main.cd682685b0beea93bbaf.js:49050)
    at ComponentRecipes.push.../node_modules/ag-grid/dist/lib/components/framework/componentRecipes.js.ComponentRecipes.newLoadingOverlayComponent (main.cd682685b0beea93bbaf.js:48740)
    at OverlayWrapperComponent.push.../node_modules/ag-grid/dist/lib/rendering/overlays/overlayWrapperComponent.js.OverlayWrapperComponent.showLoadingOverlay (main.cd682685b0beea93bbaf.js:68183)
    at BorderLayout.push.../node_modules/ag-grid/dist/lib/layout/borderLayout.js.BorderLayout.showLoadingOverlay (main.cd682685b0beea93bbaf.js:63585)
    at GridPanel.push.../node_modules/ag-grid/dist/lib/gridPanel/gridPanel.js.GridPanel.showLoadingOverlay (main.cd682685b0beea93bbaf.js:58572)
    at GridPanel.push.../node_modules/ag-grid/dist/lib/gridPanel/gridPanel.js.GridPanel.init (main.cd682685b0beea93bbaf.js:57948)

1 个答案:

答案 0 :(得分:0)

你有runtime error。错误消息表明,有一个对象,其中应该具有属性(AG_GRID),但它的值为undefined,因此没有" undefined.AG_GRID&# 34;所以它抛出了一个TypeError。

此外,由于问题不在您的代码中,而是在您的依赖项(node_modules文件夹)中,因此可能存在强大的问题,即依赖项版本存在一些问题。

尝试:

  • 删除node_modules文件夹
  • run ng update --all
  • 运行npm install
  • 尝试本地调试

如果软件包已过时,您可能需要返回几个版本,或从项目中删除它,直到它被修复或更新。检查项目的官方存储库,因为有similar issues there:所以有可能你还不能使用角度为6的工具。