Angular2 TypeError: core_1.NgModule不是一个函数



我的Angular2应用程序在导入"primeng后出现以下错误:和

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我的包。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"
    }
}

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

Angular RC 4没有NgModule。你需要将Angular依赖项更新到2.0.0-rc。

请务必查看迁移文档以获取更新应用程序到RC5的说明

最新更新