Anguler2 TypeError:core_1.NgModule不是函数

时间:2016-09-11 13:39:50

标签: javascript angularjs

导入“primeng:1.0.0-beta.15”后,我的Angular2应用程序发出以下错误     “primeui:4.1.15”

zone.js:461 Unhandled Promise rejection: TypeError: core_1.NgModule is not a function
    at eval (http://localhost:4200/vendor/primeng/components/common/shared.js:291:16)
    at Object.eval (http://localhost:4200/vendor/primeng/components/common/shared.js:299:2)
    at eval (http://localhost:4200/vendor/primeng/components/common/shared.js:302:4)
    at eval (http://localhost:4200/vendor/primeng/components/common/shared.js:303:3)
Evaluating http://localhost:4200/vendor/primeng/components/common/shared.js
Evaluating http://localhost:4200/vendor/primeng/primeng.js
Evaluating http://localhost:4200/app/app-sidebar/manageSubCatagory.component.js
Evaluating http://localhost:4200/app/app-sidebar/index.js
Evaluating http://localhost:4200/app/app.component.js
Evaluating http://localhost:4200/app/index.js
Evaluating http://localhost:4200/main.js
Error loading http://localhost:4200/main.js ; Zone: <root> ; Task: Promise.then ; Value: Error: TypeError: core_1.NgModule is not a function(…)

我正在为此项目使用Anguler CLI 我的package.json代码是

{
   "name": "erp",
   "version": "0.0.0",
   "license": "MIT",
   "angular-cli": {},
   "scripts": {
     "start": "ng serve",
     "postinstall": "typings install",
     "lint": "tslint \"src/**/*.ts\"",
     "test": "ng test",
     "pree2e": "webdriver-manager update",
     "e2e": "protractor"
   },
   "private": true,
   "dependencies": {
     "@angular/common": "2.0.0-rc.4",
     "@angular/compiler": "2.0.0-rc.4",
     "@angular/core": "2.0.0-rc.4",
     "@angular/forms": "0.2.0",
     "@angular/http": "2.0.0-rc.4",
     "@angular/platform-browser": "2.0.0-rc.4",
     "@angular/platform-browser-dynamic": "2.0.0-rc.4",
     "@angular/router": "3.0.0-beta.2",
     "es6-shim": "0.35.1",
     "primeng": "^1.0.0-beta.15",
     "primeui": "^4.1.15",
     "reflect-metadata": "0.1.3",
     "rxjs": "5.0.0-beta.6",
     "systemjs": "0.19.26",
     "zone.js": "0.6.12"
   },
   "devDependencies": {
      "angular-cli": "1.0.0-beta.10",
      "codelyzer": "0.0.20",
      "ember-cli-inject-live-reload": "1.4.0",
      "jasmine-core": "2.4.1",
      "jasmine-spec-reporter": "2.5.0",
      "karma": "0.13.22",
      "karma-chrome-launcher": "0.2.3",
      "karma-jasmine": "0.3.8",
      "protractor": "3.3.0",
      "ts-node": "0.5.5",
      "tslint": "3.11.0",
      "typescript": "1.8.10",
      "typings": "1.3.1"
    }
}

你能给我一个解决这个问题的建议吗?

1 个答案:

答案 0 :(得分:1)

Angular RC 4没有NgModule。您需要将Angular依赖项更新为2.0.0-rc.5或更高版本。

请务必查看migration docs有关将应用更新为RC5的说明。